[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', ''))
|
||||
|
||||
actors = {}
|
||||
for actor in splitString(movie.get('Actors', '')):
|
||||
actors[actor] = '' #omdb does not return actor roles
|
||||
|
||||
movie_data = {
|
||||
'type': 'movie',
|
||||
'via_imdb': True,
|
||||
@@ -105,7 +109,7 @@ class OMDBAPI(MovieProvider):
|
||||
'genres': splitString(movie.get('Genre', '')),
|
||||
'directors': splitString(movie.get('Director', '')),
|
||||
'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)
|
||||
except:
|
||||
|
||||
@@ -111,10 +111,13 @@ class TheMovieDb(MovieProvider):
|
||||
year = None
|
||||
|
||||
# Gather actors data
|
||||
actors = []
|
||||
actors = {}
|
||||
for cast_item in movie.cast:
|
||||
actors.append({toUnicode(cast_item.name): toUnicode(cast_item.character)})
|
||||
images.append({'actor %s' % toUnicode(cast_item.name): self.getImage(cast_item, type = 'profile', size = 'original')})
|
||||
try:
|
||||
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 = {
|
||||
'type': 'movie',
|
||||
@@ -130,7 +133,7 @@ class TheMovieDb(MovieProvider):
|
||||
'plot': movie.overview,
|
||||
'genres': genres,
|
||||
'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)
|
||||
@@ -154,7 +157,7 @@ class TheMovieDb(MovieProvider):
|
||||
try:
|
||||
image_url = getattr(movie, type).geturl(size = 'original')
|
||||
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
|
||||
|
||||
|
||||
@@ -89,7 +89,9 @@ class XBMC(MetaDataBase):
|
||||
genres.text = toUnicode(genre)
|
||||
|
||||
# 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')
|
||||
name = SubElement(actor, 'name')
|
||||
name.text = toUnicode(actor_name)
|
||||
|
||||
Reference in New Issue
Block a user