[Metadata][XBMC] Update new actors to actor_roles
This commit is contained in:
@@ -84,6 +84,10 @@ class OMDBAPI(MovieProvider):
|
|||||||
|
|
||||||
year = tryInt(movie.get('Year', ''))
|
year = tryInt(movie.get('Year', ''))
|
||||||
|
|
||||||
|
actors = {}
|
||||||
|
for actor in splitString(movie.get('Actors', '')):
|
||||||
|
actors[actor] = '' #omdb does not return actor roles
|
||||||
|
|
||||||
movie_data = {
|
movie_data = {
|
||||||
'type': 'movie',
|
'type': 'movie',
|
||||||
'via_imdb': True,
|
'via_imdb': True,
|
||||||
@@ -105,7 +109,7 @@ class OMDBAPI(MovieProvider):
|
|||||||
'genres': splitString(movie.get('Genre', '')),
|
'genres': splitString(movie.get('Genre', '')),
|
||||||
'directors': splitString(movie.get('Director', '')),
|
'directors': splitString(movie.get('Director', '')),
|
||||||
'writers': splitString(movie.get('Writer', '')),
|
'writers': splitString(movie.get('Writer', '')),
|
||||||
'actors': [{actor: ''} for actor in splitString(movie.get('Actors', ''))],
|
'actor_roles': actors,
|
||||||
}
|
}
|
||||||
movie_data = dict((k, v) for k, v in movie_data.iteritems() if v)
|
movie_data = dict((k, v) for k, v in movie_data.iteritems() if v)
|
||||||
except:
|
except:
|
||||||
|
|||||||
@@ -111,10 +111,13 @@ class TheMovieDb(MovieProvider):
|
|||||||
year = None
|
year = None
|
||||||
|
|
||||||
# Gather actors data
|
# Gather actors data
|
||||||
actors = []
|
actors = {}
|
||||||
for cast_item in movie.cast:
|
for cast_item in movie.cast:
|
||||||
actors.append({toUnicode(cast_item.name): toUnicode(cast_item.character)})
|
try:
|
||||||
images.append({'actor %s' % toUnicode(cast_item.name): self.getImage(cast_item, type = 'profile', size = 'original')})
|
actors[toUnicode(cast_item.name)] = toUnicode(cast_item.character)
|
||||||
|
images['actor %s' % toUnicode(cast_item.name)] = self.getImage(cast_item, type = 'profile', size = 'original')
|
||||||
|
except:
|
||||||
|
log.debug('Error getting cast info for %s: %s', (cast_item, traceback.format_exc()))
|
||||||
|
|
||||||
movie_data = {
|
movie_data = {
|
||||||
'type': 'movie',
|
'type': 'movie',
|
||||||
@@ -130,7 +133,7 @@ class TheMovieDb(MovieProvider):
|
|||||||
'plot': movie.overview,
|
'plot': movie.overview,
|
||||||
'genres': genres,
|
'genres': genres,
|
||||||
'collection': getattr(movie.collection, 'name', None),
|
'collection': getattr(movie.collection, 'name', None),
|
||||||
'actors': actors
|
'actor_roles': actors
|
||||||
}
|
}
|
||||||
|
|
||||||
movie_data = dict((k, v) for k, v in movie_data.iteritems() if v)
|
movie_data = dict((k, v) for k, v in movie_data.iteritems() if v)
|
||||||
@@ -154,7 +157,7 @@ class TheMovieDb(MovieProvider):
|
|||||||
try:
|
try:
|
||||||
image_url = getattr(movie, type).geturl(size = 'original')
|
image_url = getattr(movie, type).geturl(size = 'original')
|
||||||
except:
|
except:
|
||||||
log.debug('Failed getting %s.%s for "%s"', (type, size, movie.title))
|
log.debug('Failed getting %s.%s for "%s"', (type, size, movie))
|
||||||
|
|
||||||
return image_url
|
return image_url
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,9 @@ class XBMC(MetaDataBase):
|
|||||||
genres.text = toUnicode(genre)
|
genres.text = toUnicode(genre)
|
||||||
|
|
||||||
# Actors
|
# Actors
|
||||||
for actor_name, role_name in movie_info.get('actors', {}):
|
for actor_name in movie_info.get('actor_roles', {}):
|
||||||
|
role_name = movie_info['actor_roles'][actor_name]
|
||||||
|
|
||||||
actor = SubElement(nfoxml, 'actor')
|
actor = SubElement(nfoxml, 'actor')
|
||||||
name = SubElement(actor, 'name')
|
name = SubElement(actor, 'name')
|
||||||
name.text = toUnicode(actor_name)
|
name.text = toUnicode(actor_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user