diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 909b1155..6aa7d113 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -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 diff --git a/lib/tvdb_api_v1/tvdb_api.py b/lib/tvdb_api_v1/tvdb_api.py index 36716645..d5854d03 100644 --- a/lib/tvdb_api_v1/tvdb_api.py +++ b/lib/tvdb_api_v1/tvdb_api.py @@ -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) diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py index f1bd7354..8a083b11 100755 --- a/sickbeard/__init__.py +++ b/sickbeard/__init__.py @@ -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 diff --git a/sickbeard/config.py b/sickbeard/config.py index b9c4a6b8..819665df 100644 --- a/sickbeard/config.py +++ b/sickbeard/config.py @@ -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))