1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-26 09:37:25 +00:00
This commit is contained in:
Louis Vézina 2020-05-19 23:20:35 -04:00
parent 7661e09068
commit 5b44007bbb

View file

@ -75,11 +75,22 @@ class Restart(Resource):
class Badges(Resource):
@authenticate
def get(self):
sonarr_only_monitored_where_clause = ''
if settings.sonarr.getboolean('only_monitored'):
sonarr_only_monitored_where_clause = " AND table_episodes.monitored == 'True'"
radarr_only_monitored_where_clause = ''
if settings.radarr.getboolean('only_monitored'):
radarr_only_monitored_where_clause = " AND table_movies.monitored == 'True'"
result = {
"missing_episodes": database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE missing_subtitles "
"is not null AND missing_subtitles != '[]'", only_one=True)['count'],
"is not null AND missing_subtitles != '[]'" +
sonarr_only_monitored_where_clause, only_one=True)['count'],
"missing_movies": database.execute("SELECT COUNT(*) as count FROM table_movies WHERE missing_subtitles "
"is not null AND missing_subtitles != '[]'", only_one=True)['count'],
"is not null AND missing_subtitles != '[]'" +
radarr_only_monitored_where_clause, only_one=True)['count'],
"throttled_providers": len(eval(str(settings.general.throtteled_providers)))
}
return jsonify(result)