From d7f06bb707e74bd24b89d94dd9486a4c60601738 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Mon, 2 Dec 2024 21:16:54 -0500 Subject: [PATCH] Fixed issue with some DB queries and PostgreSQL. --- bazarr/api/badges/badges.py | 4 ++-- bazarr/api/episodes/wanted.py | 2 +- bazarr/api/movies/wanted.py | 2 +- bazarr/api/series/series.py | 2 +- bazarr/subtitles/mass_download/movies.py | 2 +- bazarr/subtitles/mass_download/series.py | 2 +- bazarr/subtitles/wanted/movies.py | 2 +- bazarr/subtitles/wanted/series.py | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/bazarr/api/badges/badges.py b/bazarr/api/badges/badges.py index 42e958cc5..aa0a1ff08 100644 --- a/bazarr/api/badges/badges.py +++ b/bazarr/api/badges/badges.py @@ -36,7 +36,7 @@ class Badges(Resource): def get(self): """Get badges count to update the UI""" episodes_conditions = [(TableEpisodes.missing_subtitles.is_not(None)), - (TableEpisodes.missing_subtitles.is_not('[]'))] + (TableEpisodes.missing_subtitles != '[]')] episodes_conditions += get_exclusion_clause('series') missing_episodes = database.execute( select(TableEpisodes.missing_subtitles) @@ -49,7 +49,7 @@ class Badges(Resource): missing_episodes_count += len(ast.literal_eval(episode.missing_subtitles)) movies_conditions = [(TableMovies.missing_subtitles.is_not(None)), - (TableMovies.missing_subtitles.is_not('[]'))] + (TableMovies.missing_subtitles != '[]')] movies_conditions += get_exclusion_clause('movie') missing_movies = database.execute( select(TableMovies.missing_subtitles) diff --git a/bazarr/api/episodes/wanted.py b/bazarr/api/episodes/wanted.py index 4a6ec3641..caa656024 100644 --- a/bazarr/api/episodes/wanted.py +++ b/bazarr/api/episodes/wanted.py @@ -49,7 +49,7 @@ class EpisodesWanted(Resource): episodeid = args.get('episodeid[]') wanted_conditions = [(TableEpisodes.missing_subtitles.is_not(None)), - (TableEpisodes.missing_subtitles.is_not('[]'))] + (TableEpisodes.missing_subtitles != '[]')] if len(episodeid) > 0: wanted_conditions.append((TableEpisodes.sonarrEpisodeId in episodeid)) start = 0 diff --git a/bazarr/api/movies/wanted.py b/bazarr/api/movies/wanted.py index ba22cd725..406c1c6b4 100644 --- a/bazarr/api/movies/wanted.py +++ b/bazarr/api/movies/wanted.py @@ -46,7 +46,7 @@ class MoviesWanted(Resource): radarrid = args.get("radarrid[]") wanted_conditions = [(TableMovies.missing_subtitles.is_not(None)), - (TableMovies.missing_subtitles.is_not('[]'))] + (TableMovies.missing_subtitles != '[]')] if len(radarrid) > 0: wanted_conditions.append((TableMovies.radarrId.in_(radarrid))) start = 0 diff --git a/bazarr/api/series/series.py b/bazarr/api/series/series.py index a9b73c451..b858f03de 100644 --- a/bazarr/api/series/series.py +++ b/bazarr/api/series/series.py @@ -74,7 +74,7 @@ class Series(Resource): .subquery() episodes_missing_conditions = [(TableEpisodes.missing_subtitles.is_not(None)), - (TableEpisodes.missing_subtitles.is_not('[]'))] + (TableEpisodes.missing_subtitles != '[]')] episodes_missing_conditions += get_exclusion_clause('series') episodeMissingCount = select(TableShows.sonarrSeriesId, diff --git a/bazarr/subtitles/mass_download/movies.py b/bazarr/subtitles/mass_download/movies.py index 155b1319a..5ca94a81f 100644 --- a/bazarr/subtitles/mass_download/movies.py +++ b/bazarr/subtitles/mass_download/movies.py @@ -20,7 +20,7 @@ from ..download import generate_subtitles def movies_download_subtitles(no): - conditions = [(TableMovies.radarrId.is_(no))] + conditions = [(TableMovies.radarrId == no)] conditions += get_exclusion_clause('movie') stmt = select(TableMovies.path, TableMovies.missing_subtitles, diff --git a/bazarr/subtitles/mass_download/series.py b/bazarr/subtitles/mass_download/series.py index 1760ad20b..54f651620 100644 --- a/bazarr/subtitles/mass_download/series.py +++ b/bazarr/subtitles/mass_download/series.py @@ -29,7 +29,7 @@ def series_download_subtitles(no): raise OSError conditions = [(TableEpisodes.sonarrSeriesId == no), - (TableEpisodes.missing_subtitles.is_not('[]'))] + (TableEpisodes.missing_subtitles != '[]')] conditions += get_exclusion_clause('series') episodes_details = database.execute( select(TableEpisodes.sonarrEpisodeId, diff --git a/bazarr/subtitles/wanted/movies.py b/bazarr/subtitles/wanted/movies.py index f8c76be54..b47fe8afb 100644 --- a/bazarr/subtitles/wanted/movies.py +++ b/bazarr/subtitles/wanted/movies.py @@ -97,7 +97,7 @@ def wanted_download_subtitles_movie(radarr_id): def wanted_search_missing_subtitles_movies(): conditions = [(TableMovies.missing_subtitles.is_not(None)), - (TableMovies.missing_subtitles.is_not('[]'))] + (TableMovies.missing_subtitles != '[]')] conditions += get_exclusion_clause('movie') movies = database.execute( select(TableMovies.radarrId, diff --git a/bazarr/subtitles/wanted/series.py b/bazarr/subtitles/wanted/series.py index b7116e6b3..5a1e9f55b 100644 --- a/bazarr/subtitles/wanted/series.py +++ b/bazarr/subtitles/wanted/series.py @@ -102,7 +102,7 @@ def wanted_download_subtitles(sonarr_episode_id): def wanted_search_missing_subtitles_series(): conditions = [(TableEpisodes.missing_subtitles.is_not(None)), - (TableEpisodes.missing_subtitles.is_not('[]'))] + (TableEpisodes.missing_subtitles != '[]')] conditions += get_exclusion_clause('series') episodes = database.execute( select(TableEpisodes.sonarrSeriesId,