Don't allow empty titles in library
This commit is contained in:
@@ -84,6 +84,8 @@ class LibraryPlugin(Plugin):
|
|||||||
titles = info.get('titles', [])
|
titles = info.get('titles', [])
|
||||||
log.debug('Adding titles: %s' % titles)
|
log.debug('Adding titles: %s' % titles)
|
||||||
for title in titles:
|
for title in titles:
|
||||||
|
if not title:
|
||||||
|
continue
|
||||||
t = LibraryTitle(
|
t = LibraryTitle(
|
||||||
title = toUnicode(title),
|
title = toUnicode(title),
|
||||||
simple_title = self.simplifyTitle(title),
|
simple_title = self.simplifyTitle(title),
|
||||||
|
|||||||
@@ -33,13 +33,19 @@ class Searcher(Plugin):
|
|||||||
).all()
|
).all()
|
||||||
|
|
||||||
for movie in movies:
|
for movie in movies:
|
||||||
|
movie_dict = movie.to_dict({
|
||||||
self.single(movie.to_dict({
|
|
||||||
'profile': {'types': {'quality': {}}},
|
'profile': {'types': {'quality': {}}},
|
||||||
'releases': {'status': {}, 'quality': {}},
|
'releases': {'status': {}, 'quality': {}},
|
||||||
'library': {'titles': {}, 'files':{}},
|
'library': {'titles': {}, 'files':{}},
|
||||||
'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
|
# Break if CP wants to shut down
|
||||||
if self.shuttingDown():
|
if self.shuttingDown():
|
||||||
|
|||||||
@@ -61,13 +61,16 @@ class IMDBAPI(MovieProvider):
|
|||||||
if isinstance(movie, (str, unicode)):
|
if isinstance(movie, (str, unicode)):
|
||||||
movie = json.loads(movie)
|
movie = json.loads(movie)
|
||||||
|
|
||||||
|
if movie.get('Response') == 'Parse Error':
|
||||||
|
return movie_data
|
||||||
|
|
||||||
tmp_movie = movie.copy()
|
tmp_movie = movie.copy()
|
||||||
for key in tmp_movie:
|
for key in tmp_movie:
|
||||||
if tmp_movie.get(key).lower() == 'n/a':
|
if tmp_movie.get(key).lower() == 'n/a':
|
||||||
del movie[key]
|
del movie[key]
|
||||||
|
|
||||||
movie_data = {
|
movie_data = {
|
||||||
'titles': [movie.get('Title', '')],
|
'titles': [movie.get('Title')] if movie.get('Title') else [],
|
||||||
'original_title': movie.get('Title', ''),
|
'original_title': movie.get('Title', ''),
|
||||||
'images': {
|
'images': {
|
||||||
'poster': [movie.get('Poster', '')] if movie.get('Poster') and len(movie.get('Poster', '')) > 4 else [],
|
'poster': [movie.get('Poster', '')] if movie.get('Poster') and len(movie.get('Poster', '')) > 4 else [],
|
||||||
|
|||||||
Reference in New Issue
Block a user