diff options
author | Louis Vézina <[email protected]> | 2019-12-03 21:36:50 -0500 |
---|---|---|
committer | Louis Vézina <[email protected]> | 2019-12-03 21:36:50 -0500 |
commit | 2e7a78cde66bed7f3ec94c41cc2bc54605d88216 (patch) | |
tree | 257d81470501c6db782b32e3de645729b232f7f2 | |
parent | 4df312438a6cfcc5a8cb6f888cd74dc975e8d72b (diff) | |
download | bazarr-2e7a78cde66bed7f3ec94c41cc2bc54605d88216.tar.gz bazarr-2e7a78cde66bed7f3ec94c41cc2bc54605d88216.zip |
Fix for multiple episode where only the first one was being updated with existing subtitles.
-rw-r--r-- | bazarr/list_subtitles.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/bazarr/list_subtitles.py b/bazarr/list_subtitles.py index 607baec19..cc08a37c2 100644 --- a/bazarr/list_subtitles.py +++ b/bazarr/list_subtitles.py @@ -90,14 +90,15 @@ def store_subtitles(original_path, reversed_path): database.execute("UPDATE table_episodes SET subtitles=? WHERE path=?", (str(actual_subtitles), original_path)) - episode = database.execute("SELECT sonarrEpisodeId FROM table_episodes WHERE path=?", - (original_path,), only_one=True) + matching_episodes = database.execute("SELECT sonarrEpisodeId FROM table_episodes WHERE path=?", + (original_path,)) - if episode: - logging.debug("BAZARR storing those languages to DB: " + str(actual_subtitles)) - list_missing_subtitles(epno=episode['sonarrEpisodeId']) - else: - logging.debug("BAZARR haven't been able to update existing subtitles to DB : " + str(actual_subtitles)) + for episode in matching_episodes: + if episode: + logging.debug("BAZARR storing those languages to DB: " + str(actual_subtitles)) + list_missing_subtitles(epno=episode['sonarrEpisodeId']) + else: + logging.debug("BAZARR haven't been able to update existing subtitles to DB : " + str(actual_subtitles)) else: logging.debug("BAZARR this file doesn't seems to exist or isn't accessible.") @@ -161,13 +162,14 @@ def store_subtitles_movie(original_path, reversed_path): database.execute("UPDATE table_movies SET subtitles=? WHERE path=?", (str(actual_subtitles), original_path)) - movie = database.execute("SELECT radarrId FROM table_movies WHERE path=?", (original_path,), only_one=True) + matching_movies = database.execute("SELECT radarrId FROM table_movies WHERE path=?", (original_path,)) - if movie: - logging.debug("BAZARR storing those languages to DB: " + str(actual_subtitles)) - list_missing_subtitles_movies(no=movie['radarrId']) - else: - logging.debug("BAZARR haven't been able to update existing subtitles to DB : " + str(actual_subtitles)) + for movie in matching_movies: + if movie: + logging.debug("BAZARR storing those languages to DB: " + str(actual_subtitles)) + list_missing_subtitles_movies(no=movie['radarrId']) + else: + logging.debug("BAZARR haven't been able to update existing subtitles to DB : " + str(actual_subtitles)) else: logging.debug("BAZARR this file doesn't seems to exist or isn't accessible.") |