pull/745/head
Louis Vézina 5 years ago
parent db7951ced2
commit a7689393e1

@ -62,19 +62,21 @@ def update_series():
seriesListLength = len(r.json()) seriesListLength = len(r.json())
for i, show in enumerate(r.json(), 1): for i, show in enumerate(r.json(), 1):
notifications.write(msg="Getting series data from Sonarr...", queue='get_series', item=i, length=seriesListLength) notifications.write(msg="Getting series data from Sonarr...", queue='get_series', item=i, length=seriesListLength)
try:
overview = six.text_type(show['overview']) if 'overview' in show:
except: overview = show['overview']
overview = "" else:
try: overview = ''
poster_big = show['images'][2]['url'].split('?')[0]
poster = os.path.splitext(poster_big)[0] + '-250' + os.path.splitext(poster_big)[1] poster = ''
except: fanart = ''
poster = "" for image in show['images']:
try: if image['coverType'] == 'poster':
fanart = show['images'][0]['url'].split('?')[0] poster_big = image['url'].split('?')[0]
except: poster = os.path.splitext(poster_big)[0] + '-250' + os.path.splitext(poster_big)[1]
fanart = ""
if image['coverType'] == 'fanart':
fanart = image['url'].split('?')[0]
if show['alternateTitles'] != None: if show['alternateTitles'] != None:
alternateTitles = str([item['title'] for item in show['alternateTitles']]) alternateTitles = str([item['title'] for item in show['alternateTitles']])
@ -85,17 +87,17 @@ def update_series():
current_shows_sonarr.append(show['id']) current_shows_sonarr.append(show['id'])
if show['id'] in current_shows_db_list: if show['id'] in current_shows_db_list:
series_to_update.append({'title': six.text_type(show["title"]), series_to_update.append({'title': show["title"],
'path': six.text_type(show["path"]), 'path': show["path"],
'tvdbId': int(show["tvdbId"]), 'tvdbId': int(show["tvdbId"]),
'sonarrSeriesId': int(show["id"]), 'sonarrSeriesId': int(show["id"]),
'overview': six.text_type(overview), 'overview': overview,
'poster': six.text_type(poster), 'poster': poster,
'fanart': six.text_type(fanart), 'fanart': fanart,
'audio_language': six.text_type(profile_id_to_language((show['qualityProfileId'] if get_sonarr_version().startswith('2') else show['languageProfileId']), audio_profiles)), 'audio_language': profile_id_to_language((show['qualityProfileId'] if get_sonarr_version().startswith('2') else show['languageProfileId']), audio_profiles),
'sortTitle': six.text_type(show['sortTitle']), 'sortTitle': show['sortTitle'],
'year': six.text_type(show['year']), 'year': show['year'],
'alternateTitles': six.text_type(alternateTitles)}) 'alternateTitles': alternateTitles})
else: else:
if serie_default_enabled is True: if serie_default_enabled is True:
series_to_add.append({'title': show["title"], series_to_add.append({'title': show["title"],

Loading…
Cancel
Save