Don't allow empty titles in library
This commit is contained in:
@@ -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),
|
||||
|
||||
@@ -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 [],
|
||||
|
||||
Reference in New Issue
Block a user