Some DB fixes.

This commit is contained in:
Louis Vézina 2019-10-30 18:07:39 -04:00
parent 24fc1473df
commit c933481d9a
4 changed files with 7 additions and 6 deletions

View File

@ -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)) +

View File

@ -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:

View File

@ -89,7 +89,7 @@
</div>
</td>
<td>
% 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']))

View File

@ -104,7 +104,7 @@
</div>
</td>
<td>
% 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']))