Make DownloadLimitSxceeded instantly throttled

This commit is contained in:
Halali 2019-09-08 14:45:05 +02:00
parent fef399d0a4
commit 486935a465
1 changed files with 2 additions and 1 deletions

View File

@ -12,6 +12,7 @@ from subliminal_patch.exceptions import TooManyRequests, APIThrottled
from subliminal.exceptions import DownloadLimitExceeded, ServiceUnavailable
VALID_THROTTLE_EXCEPTIONS = (TooManyRequests, DownloadLimitExceeded, ServiceUnavailable, APIThrottled)
VALID_COUNT_EXCEPTIONS = ('TooManyRequests', 'ServiceUnavailable', 'APIThrottled')
PROVIDER_THROTTLE_MAP = {
"default": {
@ -140,7 +141,7 @@ def provider_throttle(name, exception):
throttle_delta, throttle_description = throttle_data
throttle_until = datetime.datetime.now() + throttle_delta
if throttled_count(name):
if cls_name not in VALID_COUNT_EXCEPTIONS or throttled_count(name):
tp[name] = (cls_name, throttle_until, throttle_description)
settings.general.throtteled_providers = str(tp)
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle: