Don't allow empty titles in library

This commit is contained in:
Ruud
2012-04-04 23:53:34 +02:00
parent ed280b988b
commit b595cf8ebc
3 changed files with 15 additions and 4 deletions
+2
View File
@@ -84,6 +84,8 @@ class LibraryPlugin(Plugin):
titles = info.get('titles', [])
log.debug('Adding titles: %s' % titles)
for title in titles:
if not title:
continue
t = LibraryTitle(
title = toUnicode(title),
simple_title = self.simplifyTitle(title),
+9 -3
View File
@@ -33,13 +33,19 @@ class Searcher(Plugin):
).all()
for movie in movies:
self.single(movie.to_dict({
movie_dict = movie.to_dict({
'profile': {'types': {'quality': {}}},
'releases': {'status': {}, 'quality': {}},
'library': {'titles': {}, 'files':{}},
'files': {}
}))
})
try:
self.single(movie_dict)
except IndexError:
fireEvent('library.update', movie_dict['library']['identifier'], force = True)
except:
log.error('Search failed for %s: %s' % (movie_dict['library']['identifier'], traceback.format_exc()))
# Break if CP wants to shut down
if self.shuttingDown():
@@ -61,13 +61,16 @@ class IMDBAPI(MovieProvider):
if isinstance(movie, (str, unicode)):
movie = json.loads(movie)
if movie.get('Response') == 'Parse Error':
return movie_data
tmp_movie = movie.copy()
for key in tmp_movie:
if tmp_movie.get(key).lower() == 'n/a':
del movie[key]
movie_data = {
'titles': [movie.get('Title', '')],
'titles': [movie.get('Title')] if movie.get('Title') else [],
'original_title': movie.get('Title', ''),
'images': {
'poster': [movie.get('Poster', '')] if movie.get('Poster') and len(movie.get('Poster', '')) > 4 else [],