mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-25 17:17:12 +00:00
Handle invalid content in the throttled_providers data file
This commit is contained in:
commit
337578f79e
1 changed files with 10 additions and 2 deletions
|
@ -105,7 +105,7 @@ def get_providers():
|
||||||
logging.info("Using %s again after %s, (disabled because: %s)", provider, throttle_desc, reason)
|
logging.info("Using %s again after %s, (disabled because: %s)", provider, throttle_desc, reason)
|
||||||
del tp[provider]
|
del tp[provider]
|
||||||
set_throttled_providers(str(tp))
|
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
|
# 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:
|
# for provider in providers_list:
|
||||||
# if provider in PROVIDERS_FORCED_OFF:
|
# if provider in PROVIDERS_FORCED_OFF:
|
||||||
|
@ -298,4 +298,12 @@ def set_throttled_providers(data):
|
||||||
handle.write(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()))
|
||||||
|
|
Loading…
Reference in a new issue