Skip to content

Commit

Permalink
Fixed issue with some DB queries and PostgreSQL.
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Dec 3, 2024
1 parent 669ed06 commit d7f06bb
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions bazarr/api/badges/badges.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -49,7 +49,7 @@ def get(self):
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)
Expand Down
2 changes: 1 addition & 1 deletion bazarr/api/episodes/wanted.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def get(self):
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
Expand Down
2 changes: 1 addition & 1 deletion bazarr/api/movies/wanted.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def get(self):
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
Expand Down
2 changes: 1 addition & 1 deletion bazarr/api/series/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get(self):
.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,
Expand Down
2 changes: 1 addition & 1 deletion bazarr/subtitles/mass_download/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@


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,
Expand Down
2 changes: 1 addition & 1 deletion bazarr/subtitles/mass_download/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion bazarr/subtitles/wanted/movies.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion bazarr/subtitles/wanted/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit d7f06bb

Please sign in to comment.