From 7502c596380236a34cf6516c5d88b1877c5e0ec5 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sat, 25 Feb 2023 08:43:35 -0500 Subject: [PATCH] no log: small fix for announcements and enabled providers --- bazarr/app/announcements.py | 4 ++-- bazarr/app/get_providers.py | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/bazarr/app/announcements.py b/bazarr/app/announcements.py index 4c49dce24..be01d67a7 100644 --- a/bazarr/app/announcements.py +++ b/bazarr/app/announcements.py @@ -10,7 +10,7 @@ import pretty from datetime import datetime from operator import itemgetter -from app.get_providers import get_providers +from app.get_providers import get_enabled_providers from app.database import TableAnnouncements from .get_args import args @@ -74,7 +74,7 @@ def get_local_announcements(): announcements = [] # opensubtitles.org end-of-life - enabled_providers = get_providers() + enabled_providers = get_enabled_providers() if enabled_providers and 'opensubtitles' in enabled_providers: announcements.append({ 'text': 'Opensubtitles.org will be deprecated soon, migrate to Opensubtitles.com ASAP and disable this ' diff --git a/bazarr/app/get_providers.py b/bazarr/app/get_providers.py index c3bccd446..d73c109b6 100644 --- a/bazarr/app/get_providers.py +++ b/bazarr/app/get_providers.py @@ -1,5 +1,6 @@ # coding=utf-8 +import ast import os import datetime import pytz @@ -143,6 +144,14 @@ def get_providers(): return providers_list +def get_enabled_providers(): + # return enabled provider including those who can be throttled + try: + return ast.literal_eval(settings.general.enabled_providers) + except (ValueError, TypeError, SyntaxError, MemoryError, RecursionError): + return [] + + _FFPROBE_BINARY = get_binary("ffprobe") _FFMPEG_BINARY = get_binary("ffmpeg")