diff --git a/bazarr/get_subtitle.py b/bazarr/get_subtitle.py index 221417c49..2be650122 100644 --- a/bazarr/get_subtitle.py +++ b/bazarr/get_subtitle.py @@ -996,7 +996,8 @@ def upgrade_subtitles(): "table_history.score, table_shows.hearing_impaired, " "table_episodes.scene_name, table_episodes.title," "table_episodes.sonarrSeriesId, table_episodes.sonarrEpisodeId," - "MAX(table_history.timestamp), table_shows.languages, table_shows.forced " + "MAX(table_history.timestamp) as timestamp, " + "table_shows.languages, table_shows.forced " "FROM table_history INNER JOIN table_shows on " "table_shows.sonarrSeriesId = table_history.sonarrSeriesId INNER JOIN " "table_episodes on table_episodes.sonarrEpisodeId = " @@ -1028,7 +1029,7 @@ def upgrade_subtitles(): upgradable_movies = database.execute("SELECT table_history_movie.video_path, table_history_movie.language, " "table_history_movie.score, table_movies.hearing_impaired, " "table_movies.sceneName, table_movies.title, table_movies.radarrId, " - "MAX(table_history_movie.timestamp), table_movies.languages, " + "MAX(table_history_movie.timestamp) as timestamp, table_movies.languages, " "table_movies.forced FROM table_history_movie INNER JOIN " "table_movies on table_movies.radarrId = table_history_movie.radarrId " "WHERE action IN (" + ','.join(map(str, query_actions)) + diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index bd3caf4e9..a1b5e983a 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -110,7 +110,7 @@ def store_subtitles(file): episode = database.execute("SELECT sonarrEpisodeId FROM table_episodes WHERE path=?", (path_replace_reverse(file),), only_one=True) - if len(episode): + if episode: logging.debug("BAZARR storing those languages to DB: " + str(actual_subtitles)) list_missing_subtitles(epno=episode['sonarrEpisodeId']) else: @@ -208,7 +208,7 @@ def store_subtitles_movie(file): movie = database.execute("SELECT radarrId FROM table_movies WHERE path=?", (path_replace_reverse_movie(file),), only_one=True) - if len(movie): + if movie: logging.debug("BAZARR storing those languages to DB: " + str(actual_subtitles)) list_missing_subtitles_movies(no=movie['radarrId']) else: diff --git a/views/historymovies.tpl b/views/historymovies.tpl index 27981f3c3..a10411988 100644 --- a/views/historymovies.tpl +++ b/views/historymovies.tpl @@ -89,7 +89,7 @@ - % upgradable_criteria = (row['timestamp'], row['video_path'], row['score']) + % upgradable_criteria = dict([('timestamp', row['timestamp']), ('video_path', row['video_path']), ('score', row['score'])]) % if upgradable_criteria in upgradable_movies: % if row['languages'] != "None": % desired_languages = ast.literal_eval(str(row['languages'])) diff --git a/views/historyseries.tpl b/views/historyseries.tpl index 4bbf05360..24a97f6d4 100644 --- a/views/historyseries.tpl +++ b/views/historyseries.tpl @@ -104,7 +104,7 @@ - % upgradable_criteria = (row['timestamp'], row['path'], row['score']) + % upgradable_criteria = dict([('timestamp', row['timestamp']), ('video_path', row['path']), ('score', row['score'])]) % if upgradable_criteria in upgradable_episodes: % if row['languages'] != "None": % desired_languages = ast.literal_eval(str(row['languages']))