diff options
author | morpheus65535 <[email protected]> | 2021-03-15 08:21:23 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-15 08:21:23 -0400 |
commit | 337578f79e667a9997a854cbd8de2bfe7f122976 (patch) | |
tree | d0149b6c3e997765cdb4819059f9b6585866ad4e | |
parent | 5a206e9efaa729e68acd828deb12d146a5af364c (diff) | |
parent | c55884ddad5f45dc35f43891b6bb00565840920b (diff) | |
download | bazarr-337578f79e667a9997a854cbd8de2bfe7f122976.tar.gz bazarr-337578f79e667a9997a854cbd8de2bfe7f122976.zip |
Handle invalid content in the throttled_providers data file
-rw-r--r-- | bazarr/get_providers.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/bazarr/get_providers.py b/bazarr/get_providers.py index 1ab4c0496..f06f712a8 100644 --- a/bazarr/get_providers.py +++ b/bazarr/get_providers.py @@ -105,7 +105,7 @@ def get_providers(): logging.info("Using %s again after %s, (disabled because: %s)", provider, throttle_desc, reason) del tp[provider] set_throttled_providers(str(tp)) - + # if forced only is enabled: # fixme: Prepared for forced only implementation to remove providers with don't support forced only subtitles # for provider in providers_list: # if provider in PROVIDERS_FORCED_OFF: @@ -298,4 +298,12 @@ def set_throttled_providers(data): handle.write(data) -tp = eval(str(get_throttled_providers())) +try: + tp = eval(str(get_throttled_providers())) + if not isinstance(tp, dict): + raise ValueError('tp should be a dict') +except Exception: + logging.error("Invalid content in throttled_providers.dat. Resetting") + # set empty content in throttled_providers.dat + set_throttled_providers('') + tp = eval(str(get_throttled_providers())) |