Fixed issue with some DB queries and PostgreSQL.

pull/2786/head
morpheus65535 1 month ago
parent 669ed069f5
commit d7f06bb707

@ -36,7 +36,7 @@ class Badges(Resource):
def get(self): def get(self):
"""Get badges count to update the UI""" """Get badges count to update the UI"""
episodes_conditions = [(TableEpisodes.missing_subtitles.is_not(None)), episodes_conditions = [(TableEpisodes.missing_subtitles.is_not(None)),
(TableEpisodes.missing_subtitles.is_not('[]'))] (TableEpisodes.missing_subtitles != '[]')]
episodes_conditions += get_exclusion_clause('series') episodes_conditions += get_exclusion_clause('series')
missing_episodes = database.execute( missing_episodes = database.execute(
select(TableEpisodes.missing_subtitles) select(TableEpisodes.missing_subtitles)
@ -49,7 +49,7 @@ class Badges(Resource):
missing_episodes_count += len(ast.literal_eval(episode.missing_subtitles)) missing_episodes_count += len(ast.literal_eval(episode.missing_subtitles))
movies_conditions = [(TableMovies.missing_subtitles.is_not(None)), movies_conditions = [(TableMovies.missing_subtitles.is_not(None)),
(TableMovies.missing_subtitles.is_not('[]'))] (TableMovies.missing_subtitles != '[]')]
movies_conditions += get_exclusion_clause('movie') movies_conditions += get_exclusion_clause('movie')
missing_movies = database.execute( missing_movies = database.execute(
select(TableMovies.missing_subtitles) select(TableMovies.missing_subtitles)

@ -49,7 +49,7 @@ class EpisodesWanted(Resource):
episodeid = args.get('episodeid[]') episodeid = args.get('episodeid[]')
wanted_conditions = [(TableEpisodes.missing_subtitles.is_not(None)), wanted_conditions = [(TableEpisodes.missing_subtitles.is_not(None)),
(TableEpisodes.missing_subtitles.is_not('[]'))] (TableEpisodes.missing_subtitles != '[]')]
if len(episodeid) > 0: if len(episodeid) > 0:
wanted_conditions.append((TableEpisodes.sonarrEpisodeId in episodeid)) wanted_conditions.append((TableEpisodes.sonarrEpisodeId in episodeid))
start = 0 start = 0

@ -46,7 +46,7 @@ class MoviesWanted(Resource):
radarrid = args.get("radarrid[]") radarrid = args.get("radarrid[]")
wanted_conditions = [(TableMovies.missing_subtitles.is_not(None)), wanted_conditions = [(TableMovies.missing_subtitles.is_not(None)),
(TableMovies.missing_subtitles.is_not('[]'))] (TableMovies.missing_subtitles != '[]')]
if len(radarrid) > 0: if len(radarrid) > 0:
wanted_conditions.append((TableMovies.radarrId.in_(radarrid))) wanted_conditions.append((TableMovies.radarrId.in_(radarrid)))
start = 0 start = 0

@ -74,7 +74,7 @@ class Series(Resource):
.subquery() .subquery()
episodes_missing_conditions = [(TableEpisodes.missing_subtitles.is_not(None)), episodes_missing_conditions = [(TableEpisodes.missing_subtitles.is_not(None)),
(TableEpisodes.missing_subtitles.is_not('[]'))] (TableEpisodes.missing_subtitles != '[]')]
episodes_missing_conditions += get_exclusion_clause('series') episodes_missing_conditions += get_exclusion_clause('series')
episodeMissingCount = select(TableShows.sonarrSeriesId, episodeMissingCount = select(TableShows.sonarrSeriesId,

@ -20,7 +20,7 @@ from ..download import generate_subtitles
def movies_download_subtitles(no): def movies_download_subtitles(no):
conditions = [(TableMovies.radarrId.is_(no))] conditions = [(TableMovies.radarrId == no)]
conditions += get_exclusion_clause('movie') conditions += get_exclusion_clause('movie')
stmt = select(TableMovies.path, stmt = select(TableMovies.path,
TableMovies.missing_subtitles, TableMovies.missing_subtitles,

@ -29,7 +29,7 @@ def series_download_subtitles(no):
raise OSError raise OSError
conditions = [(TableEpisodes.sonarrSeriesId == no), conditions = [(TableEpisodes.sonarrSeriesId == no),
(TableEpisodes.missing_subtitles.is_not('[]'))] (TableEpisodes.missing_subtitles != '[]')]
conditions += get_exclusion_clause('series') conditions += get_exclusion_clause('series')
episodes_details = database.execute( episodes_details = database.execute(
select(TableEpisodes.sonarrEpisodeId, select(TableEpisodes.sonarrEpisodeId,

@ -97,7 +97,7 @@ def wanted_download_subtitles_movie(radarr_id):
def wanted_search_missing_subtitles_movies(): def wanted_search_missing_subtitles_movies():
conditions = [(TableMovies.missing_subtitles.is_not(None)), conditions = [(TableMovies.missing_subtitles.is_not(None)),
(TableMovies.missing_subtitles.is_not('[]'))] (TableMovies.missing_subtitles != '[]')]
conditions += get_exclusion_clause('movie') conditions += get_exclusion_clause('movie')
movies = database.execute( movies = database.execute(
select(TableMovies.radarrId, select(TableMovies.radarrId,

@ -102,7 +102,7 @@ def wanted_download_subtitles(sonarr_episode_id):
def wanted_search_missing_subtitles_series(): def wanted_search_missing_subtitles_series():
conditions = [(TableEpisodes.missing_subtitles.is_not(None)), conditions = [(TableEpisodes.missing_subtitles.is_not(None)),
(TableEpisodes.missing_subtitles.is_not('[]'))] (TableEpisodes.missing_subtitles != '[]')]
conditions += get_exclusion_clause('series') conditions += get_exclusion_clause('series')
episodes = database.execute( episodes = database.execute(
select(TableEpisodes.sonarrSeriesId, select(TableEpisodes.sonarrSeriesId,

Loading…
Cancel
Save