Change TVDB data parsing for gueststars, writers and genre.

Change map gueststars to string (gueststars_list field contains original list).
Change convert writers to writer string.
Change keep genre original list in genre_list.
Change don't add/delete keys dict during iteritems.
This commit is contained in:
Prinz23 2018-07-31 01:52:07 +01:00 committed by JackDandy
parent baf5f9b008
commit 6f559fb440
2 changed files with 27 additions and 4 deletions

View file

@ -1,4 +1,9 @@
### 0.16.21 (2018-07-28 14:15:00 UTC)
### 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
* Change TVDB API 2 to version 2.2.0

View file

@ -609,9 +609,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()
@ -619,6 +623,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:
@ -633,8 +644,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: