mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-02 17:33: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):
|
||||
|
||||
cur_actors = Actors()
|
||||
a = []
|
||||
try:
|
||||
for curActorItem in actor_list:
|
||||
cur_actor = Actor()
|
||||
for k, v in curActorItem.iteritems():
|
||||
k = k.lower()
|
||||
if None is not v:
|
||||
if 'image' == k:
|
||||
v = self.config['url_artworkPrefix'] % v
|
||||
else:
|
||||
v = self._clean_data(v)
|
||||
cur_actor[k] = v
|
||||
cur_actors.append(cur_actor)
|
||||
for n in sorted(actor_list, key=lambda x: x['sortorder']):
|
||||
a.append({'character': {'id': None,
|
||||
'name': n.get('role', ''),
|
||||
'url': None, # not supported by tvdb
|
||||
'image': (None, self.config['url_artworkPrefix'] % n.get('image'))
|
||||
[n.get('image')not in (None, '')],
|
||||
},
|
||||
'person': {'id': None, # not supported by tvdb
|
||||
'name': n.get('name', ''),
|
||||
'url': '', # not supported by tvdb
|
||||
'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):
|
||||
pass
|
||||
|
||||
self._set_show_data(sid, '_actors', cur_actors)
|
||||
self._set_show_data(sid, 'actors', a)
|
||||
|
||||
def get_episode_data(self, epid):
|
||||
# Parse episode information
|
||||
|
@ -907,12 +912,7 @@ class Tvdb:
|
|||
if self.config['actors_enabled']:
|
||||
actor_data = self._getetsrc(self.config['url_actorsInfo'] % sid, language=language)
|
||||
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'])
|
||||
else:
|
||||
a = '||'
|
||||
self._set_show_data(sid, u'actors', a)
|
||||
|
||||
if get_ep_info:
|
||||
# Parse episode data
|
||||
|
|
|
@ -771,23 +771,28 @@ class TvdbV1:
|
|||
self.log('Getting actors for %s' % sid)
|
||||
actors_et = self._getetsrc(self.config['url_actorsInfo'] % sid)
|
||||
|
||||
cur_actors = Actors()
|
||||
a = []
|
||||
try:
|
||||
for curActorItem in actors_et['actor']:
|
||||
cur_actor = Actor()
|
||||
for k, v in curActorItem.items():
|
||||
k = k.lower()
|
||||
if None is not v:
|
||||
if 'image' == k:
|
||||
v = self._get_url_artwork(v)
|
||||
else:
|
||||
v = self._clean_data(v)
|
||||
cur_actor[k] = v
|
||||
cur_actors.append(cur_actor)
|
||||
for n in sorted(actors_et['Actor'], key=lambda x: x['SortOrder']):
|
||||
a.append({'character': {'id': None,
|
||||
'name': n.get('Role', ''),
|
||||
'url': None, # not supported by tvdb
|
||||
'image': (None, self.config['url_artworkPrefix'] % n.get('Image'))
|
||||
[n.get('Image')not in (None, '')],
|
||||
},
|
||||
'person': {'id': None, # not supported by tvdb
|
||||
'name': n.get('Name', ''),
|
||||
'url': '', # not supported by tvdb
|
||||
'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):
|
||||
pass
|
||||
|
||||
self._set_show_data(sid, '_actors', cur_actors)
|
||||
self._set_show_data(sid, 'actors', a)
|
||||
|
||||
def _get_show_data(self, sid, language, get_ep_info=False):
|
||||
"""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)
|
||||
|
||||
if get_ep_info:
|
||||
# Parse banners
|
||||
if self.config['banners_enabled']:
|
||||
self._parse_banners(sid)
|
||||
# Parse actors
|
||||
if self.config['actors_enabled']:
|
||||
self._parse_actors(sid)
|
||||
|
||||
# Parse actors
|
||||
if self.config['actors_enabled']:
|
||||
self._parse_actors(sid)
|
||||
# Parse banners
|
||||
if self.config['banners_enabled']:
|
||||
self._parse_banners(sid)
|
||||
|
||||
if get_ep_info:
|
||||
|
||||
# Parse episode data
|
||||
self.log('Getting all episodes of %s' % sid)
|
||||
|
|
|
@ -61,7 +61,7 @@ CFG = None
|
|||
CONFIG_FILE = None
|
||||
|
||||
# This is the version of the config we EXPECT to find
|
||||
CONFIG_VERSION = 16
|
||||
CONFIG_VERSION = 17
|
||||
|
||||
# Default encryption version (0 for None)
|
||||
ENCRYPTION_VERSION = 0
|
||||
|
|
|
@ -465,7 +465,8 @@ class ConfigMigrator:
|
|||
13: 'Change default dereferrer url to blank',
|
||||
14: 'Convert Trakt to multi-account',
|
||||
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):
|
||||
""" Calls each successive migration until the config is the same version as SG expects """
|
||||
|
@ -844,3 +845,22 @@ class ConfigMigrator:
|
|||
except OSError:
|
||||
pass
|
||||
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