mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-11 21:53:37 +00:00
Change actor struct for tvdb_api (indexer api).
Add 'vp9' and 'av1' to ignore word list.
This commit is contained in:
parent
92a5fdd192
commit
990755f966
4 changed files with 68 additions and 42 deletions
|
@ -799,23 +799,28 @@ class Tvdb:
|
||||||
|
|
||||||
def _parse_actors(self, sid, actor_list):
|
def _parse_actors(self, sid, actor_list):
|
||||||
|
|
||||||
cur_actors = Actors()
|
a = []
|
||||||
try:
|
try:
|
||||||
for curActorItem in actor_list:
|
for n in sorted(actor_list, key=lambda x: x['sortorder']):
|
||||||
cur_actor = Actor()
|
a.append({'character': {'id': None,
|
||||||
for k, v in curActorItem.iteritems():
|
'name': n.get('role', ''),
|
||||||
k = k.lower()
|
'url': None, # not supported by tvdb
|
||||||
if None is not v:
|
'image': (None, self.config['url_artworkPrefix'] % n.get('image'))
|
||||||
if 'image' == k:
|
[n.get('image')not in (None, '')],
|
||||||
v = self.config['url_artworkPrefix'] % v
|
},
|
||||||
else:
|
'person': {'id': None, # not supported by tvdb
|
||||||
v = self._clean_data(v)
|
'name': n.get('name', ''),
|
||||||
cur_actor[k] = v
|
'url': '', # not supported by tvdb
|
||||||
cur_actors.append(cur_actor)
|
'image': None, # not supported by tvdb
|
||||||
|
'birthday': None, # not supported by tvdb
|
||||||
|
'deathday': None, # not supported by tvdb
|
||||||
|
'gender': None, # not supported by tvdb
|
||||||
|
'country': None, # not supported by tvdb
|
||||||
|
},
|
||||||
|
})
|
||||||
except (StandardError, Exception):
|
except (StandardError, Exception):
|
||||||
pass
|
pass
|
||||||
|
self._set_show_data(sid, 'actors', a)
|
||||||
self._set_show_data(sid, '_actors', cur_actors)
|
|
||||||
|
|
||||||
def get_episode_data(self, epid):
|
def get_episode_data(self, epid):
|
||||||
# Parse episode information
|
# Parse episode information
|
||||||
|
@ -907,12 +912,7 @@ class Tvdb:
|
||||||
if self.config['actors_enabled']:
|
if self.config['actors_enabled']:
|
||||||
actor_data = self._getetsrc(self.config['url_actorsInfo'] % sid, language=language)
|
actor_data = self._getetsrc(self.config['url_actorsInfo'] % sid, language=language)
|
||||||
if actor_data and len(actor_data.get('data', '') or '') > 0:
|
if actor_data and len(actor_data.get('data', '') or '') > 0:
|
||||||
a = '|%s|' % '|'.join([n.get('name', '') for n in sorted(
|
|
||||||
actor_data['data'], key=lambda x: x['sortorder'])])
|
|
||||||
self._parse_actors(sid, actor_data['data'])
|
self._parse_actors(sid, actor_data['data'])
|
||||||
else:
|
|
||||||
a = '||'
|
|
||||||
self._set_show_data(sid, u'actors', a)
|
|
||||||
|
|
||||||
if get_ep_info:
|
if get_ep_info:
|
||||||
# Parse episode data
|
# Parse episode data
|
||||||
|
|
|
@ -771,23 +771,28 @@ class TvdbV1:
|
||||||
self.log('Getting actors for %s' % sid)
|
self.log('Getting actors for %s' % sid)
|
||||||
actors_et = self._getetsrc(self.config['url_actorsInfo'] % sid)
|
actors_et = self._getetsrc(self.config['url_actorsInfo'] % sid)
|
||||||
|
|
||||||
cur_actors = Actors()
|
a = []
|
||||||
try:
|
try:
|
||||||
for curActorItem in actors_et['actor']:
|
for n in sorted(actors_et['Actor'], key=lambda x: x['SortOrder']):
|
||||||
cur_actor = Actor()
|
a.append({'character': {'id': None,
|
||||||
for k, v in curActorItem.items():
|
'name': n.get('Role', ''),
|
||||||
k = k.lower()
|
'url': None, # not supported by tvdb
|
||||||
if None is not v:
|
'image': (None, self.config['url_artworkPrefix'] % n.get('Image'))
|
||||||
if 'image' == k:
|
[n.get('Image')not in (None, '')],
|
||||||
v = self._get_url_artwork(v)
|
},
|
||||||
else:
|
'person': {'id': None, # not supported by tvdb
|
||||||
v = self._clean_data(v)
|
'name': n.get('Name', ''),
|
||||||
cur_actor[k] = v
|
'url': '', # not supported by tvdb
|
||||||
cur_actors.append(cur_actor)
|
'image': None, # not supported by tvdb
|
||||||
|
'birthday': None, # not supported by tvdb
|
||||||
|
'deathday': None, # not supported by tvdb
|
||||||
|
'gender': None, # not supported by tvdb
|
||||||
|
'country': None, # not supported by tvdb
|
||||||
|
},
|
||||||
|
})
|
||||||
except (StandardError, Exception):
|
except (StandardError, Exception):
|
||||||
pass
|
pass
|
||||||
|
self._set_show_data(sid, 'actors', a)
|
||||||
self._set_show_data(sid, '_actors', cur_actors)
|
|
||||||
|
|
||||||
def _get_show_data(self, sid, language, get_ep_info=False):
|
def _get_show_data(self, sid, language, get_ep_info=False):
|
||||||
"""Takes a series ID, gets the epInfo URL and parses the TVDB
|
"""Takes a series ID, gets the epInfo URL and parses the TVDB
|
||||||
|
@ -822,14 +827,15 @@ class TvdbV1:
|
||||||
|
|
||||||
self._set_show_data(sid, k.lower(), v)
|
self._set_show_data(sid, k.lower(), v)
|
||||||
|
|
||||||
if get_ep_info:
|
# Parse actors
|
||||||
# Parse banners
|
if self.config['actors_enabled']:
|
||||||
if self.config['banners_enabled']:
|
self._parse_actors(sid)
|
||||||
self._parse_banners(sid)
|
|
||||||
|
|
||||||
# Parse actors
|
# Parse banners
|
||||||
if self.config['actors_enabled']:
|
if self.config['banners_enabled']:
|
||||||
self._parse_actors(sid)
|
self._parse_banners(sid)
|
||||||
|
|
||||||
|
if get_ep_info:
|
||||||
|
|
||||||
# Parse episode data
|
# Parse episode data
|
||||||
self.log('Getting all episodes of %s' % sid)
|
self.log('Getting all episodes of %s' % sid)
|
||||||
|
|
|
@ -61,7 +61,7 @@ CFG = None
|
||||||
CONFIG_FILE = None
|
CONFIG_FILE = None
|
||||||
|
|
||||||
# This is the version of the config we EXPECT to find
|
# This is the version of the config we EXPECT to find
|
||||||
CONFIG_VERSION = 16
|
CONFIG_VERSION = 17
|
||||||
|
|
||||||
# Default encryption version (0 for None)
|
# Default encryption version (0 for None)
|
||||||
ENCRYPTION_VERSION = 0
|
ENCRYPTION_VERSION = 0
|
||||||
|
|
|
@ -465,7 +465,8 @@ class ConfigMigrator:
|
||||||
13: 'Change default dereferrer url to blank',
|
13: 'Change default dereferrer url to blank',
|
||||||
14: 'Convert Trakt to multi-account',
|
14: 'Convert Trakt to multi-account',
|
||||||
15: 'Transmithe.net rebranded Nebulance',
|
15: 'Transmithe.net rebranded Nebulance',
|
||||||
16: 'Purge old cache image folders'}
|
16: 'Purge old cache image folders',
|
||||||
|
17: 'Add "vp9", "av1" to ignore words if not found'}
|
||||||
|
|
||||||
def migrate_config(self):
|
def migrate_config(self):
|
||||||
""" Calls each successive migration until the config is the same version as SG expects """
|
""" Calls each successive migration until the config is the same version as SG expects """
|
||||||
|
@ -844,3 +845,22 @@ class ConfigMigrator:
|
||||||
except OSError:
|
except OSError:
|
||||||
pass
|
pass
|
||||||
sickbeard.CACHE_DIR = cache_default
|
sickbeard.CACHE_DIR = cache_default
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def _migrate_v17():
|
||||||
|
# add words to ignore list and insert spaces to improve the ui config readability
|
||||||
|
words_to_add = ['vp9', 'av1']
|
||||||
|
config_words = sickbeard.IGNORE_WORDS.split(',')
|
||||||
|
new_list = []
|
||||||
|
for new_word in words_to_add:
|
||||||
|
add_word = True
|
||||||
|
for ignore_word in config_words:
|
||||||
|
ignored = ignore_word.strip().lower()
|
||||||
|
if ignored and ignored not in new_list:
|
||||||
|
new_list += [ignored]
|
||||||
|
if re.search(r'(?i)%s' % new_word, ignored):
|
||||||
|
add_word = False
|
||||||
|
if add_word:
|
||||||
|
new_list += [new_word]
|
||||||
|
|
||||||
|
sickbeard.IGNORE_WORDS = ', '.join(sorted(new_list))
|
||||||
|
|
Loading…
Reference in a new issue