diff --git a/CHANGES.md b/CHANGES.md index cd3246b9..7a8afe5f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -29,6 +29,11 @@ +### 0.16.22 (2018-08-18 12:30:00 UTC) + +* Change TVDB data parsing for gueststars, writers and genre + + ### 0.16.21 (2018-07-28 14:15:00 UTC) * Change TorrentDay diff --git a/lib/tvdb_api/tvdb_api.py b/lib/tvdb_api/tvdb_api.py index 69111892..7d4a38fe 100644 --- a/lib/tvdb_api/tvdb_api.py +++ b/lib/tvdb_api/tvdb_api.py @@ -610,9 +610,13 @@ class Tvdb: except (StandardError, Exception): raise tvdb_error - map_show = {'airstime': 'airs_time', 'airsdayofweek': 'airs_dayofweek', 'imdbid': 'imdb_id'} + map_show = {'airstime': 'airs_time', 'airsdayofweek': 'airs_dayofweek', 'imdbid': 'imdb_id', + 'writers': 'writer'} def map_show_keys(data): + keep_data = {} + del_keys = [] + new_data = {} for k, v in data.iteritems(): k_org = k k = k.lower() @@ -620,6 +624,13 @@ class Tvdb: if k in ['banner', 'fanart', 'poster'] and v: v = self.config['url_artworkPrefix'] % v elif 'genre' == k: + keep_data['genre_list'] = v + v = '|%s|' % '|'.join([self._clean_data(c) for c in v if isinstance(c, basestring)]) + elif 'gueststars' == k: + keep_data['gueststars_list'] = v + v = '|%s|' % '|'.join([self._clean_data(c) for c in v if isinstance(c, basestring)]) + elif 'writers' == k: + keep_data[k] = v v = '|%s|' % '|'.join([self._clean_data(c) for c in v if isinstance(c, basestring)]) elif 'firstaired' == k: if v: @@ -634,8 +645,15 @@ class Tvdb: if k in map_show: k = map_show[k] if k_org is not k: - del(data[k_org]) - data[k] = v + del_keys.append(k_org) + new_data[k] = v + else: + data[k] = v + for d in del_keys: + del(data[d]) + if isinstance(data, dict): + data.update(new_data) + data.update(keep_data) return data if resp: