Implemented imdbId for series.

pull/1148/head
Louis Vézina 4 years ago
parent c68180ec09
commit b2871be90c

@ -94,6 +94,7 @@ def db_upgrade():
['table_shows', 'forced', 'text', 'False'], ['table_shows', 'forced', 'text', 'False'],
['table_shows', 'tags', 'text', '[]'], ['table_shows', 'tags', 'text', '[]'],
['table_shows', 'seriesType', 'text', ''], ['table_shows', 'seriesType', 'text', ''],
['table_shows', 'imdbId', 'text', ''],
['table_episodes', 'format', 'text'], ['table_episodes', 'format', 'text'],
['table_episodes', 'resolution', 'text'], ['table_episodes', 'resolution', 'text'],
['table_episodes', 'video_codec', 'text'], ['table_episodes', 'video_codec', 'text'],

@ -83,6 +83,8 @@ def update_series():
tags = [d['label'] for d in tagsDict if d['id'] in show['tags']] tags = [d['label'] for d in tagsDict if d['id'] in show['tags']]
imdbId = show['imdbId'] if 'imdbId' in show else None
# Add shows in Sonarr to current shows list # Add shows in Sonarr to current shows list
current_shows_sonarr.append(show['id']) current_shows_sonarr.append(show['id'])
@ -99,7 +101,8 @@ def update_series():
'year': str(show['year']), 'year': str(show['year']),
'alternateTitles': alternate_titles, 'alternateTitles': alternate_titles,
'tags': str(tags), 'tags': str(tags),
'seriesType': show['seriesType']}) 'seriesType': show['seriesType'],
'imdbId': imdbId})
else: else:
series_to_add.append({'title': show["title"], series_to_add.append({'title': show["title"],
'path': show["path"], 'path': show["path"],
@ -116,7 +119,8 @@ def update_series():
'alternateTitles': alternate_titles, 'alternateTitles': alternate_titles,
'forced': serie_default_forced, 'forced': serie_default_forced,
'tags': str(tags), 'tags': str(tags),
'seriesType': show['seriesType']}) 'seriesType': show['seriesType'],
'imdbId': imdbId})
# Remove old series from DB # Remove old series from DB
removed_series = list(set(current_shows_db_list) - set(current_shows_sonarr)) removed_series = list(set(current_shows_db_list) - set(current_shows_sonarr))
@ -128,7 +132,7 @@ def update_series():
# Update existing series in DB # Update existing series in DB
series_in_db_list = [] series_in_db_list = []
series_in_db = database.execute("SELECT title, path, tvdbId, sonarrSeriesId, overview, poster, fanart, " series_in_db = database.execute("SELECT title, path, tvdbId, sonarrSeriesId, overview, poster, fanart, "
"audio_language, sortTitle, year, alternateTitles, tags, seriesType FROM table_shows") "audio_language, sortTitle, year, alternateTitles, tags, seriesType, imdbId FROM table_shows")
for item in series_in_db: for item in series_in_db:
series_in_db_list.append(item) series_in_db_list.append(item)

@ -1027,7 +1027,7 @@ def refine_from_db(path, video):
"SELECT table_shows.title as seriesTitle, table_episodes.season, table_episodes.episode, " "SELECT table_shows.title as seriesTitle, table_episodes.season, table_episodes.episode, "
"table_episodes.title as episodeTitle, table_shows.year, table_shows.tvdbId, " "table_episodes.title as episodeTitle, table_shows.year, table_shows.tvdbId, "
"table_shows.alternateTitles, table_episodes.format, table_episodes.resolution, " "table_shows.alternateTitles, table_episodes.format, table_episodes.resolution, "
"table_episodes.video_codec, table_episodes.audio_codec, table_episodes.path " "table_episodes.video_codec, table_episodes.audio_codec, table_episodes.path, table_shows.imdbId "
"FROM table_episodes INNER JOIN table_shows on " "FROM table_episodes INNER JOIN table_shows on "
"table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId " "table_shows.sonarrSeriesId = table_episodes.sonarrSeriesId "
"WHERE table_episodes.path = ?", (path_mappings.path_replace_reverse(path),), only_one=True) "WHERE table_episodes.path = ?", (path_mappings.path_replace_reverse(path),), only_one=True)
@ -1042,6 +1042,8 @@ def refine_from_db(path, video):
# if int(data['year']) > 0: video.year = int(data['year']) # if int(data['year']) > 0: video.year = int(data['year'])
video.series_tvdb_id = int(data['tvdbId']) video.series_tvdb_id = int(data['tvdbId'])
video.alternative_series = ast.literal_eval(data['alternateTitles']) video.alternative_series = ast.literal_eval(data['alternateTitles'])
if data['imdbId'] and not video.series_imdb_id:
video.series_imdb_id = data['imdbId']
if not video.source: if not video.source:
video.source = str(data['format']) video.source = str(data['format'])
if not video.resolution: if not video.resolution:

Loading…
Cancel
Save