diff options
author | morpheus65535 <[email protected]> | 2022-09-28 10:18:56 -0400 |
---|---|---|
committer | morpheus65535 <[email protected]> | 2022-09-28 10:18:56 -0400 |
commit | 0980af10608081cba784854ee0ea4e88ad816f20 (patch) | |
tree | 66559d55c291ca8694aac286a3f8fa163e80c97a | |
parent | 754fed4269c31f7663c617543813abccb140624c (diff) | |
download | bazarr-1.1.2-beta.13.tar.gz bazarr-1.1.2-beta.13.zip |
Fixed assrt provider to prevent making too many queries to the API. #1953v1.1.2-beta.13
-rw-r--r-- | libs/subliminal_patch/providers/assrt.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libs/subliminal_patch/providers/assrt.py b/libs/subliminal_patch/providers/assrt.py index a1f7caba3..6a101bba9 100644 --- a/libs/subliminal_patch/providers/assrt.py +++ b/libs/subliminal_patch/providers/assrt.py @@ -8,6 +8,7 @@ import re from babelfish import language_converters from guessit import guessit from requests import Session +from time import sleep from subliminal import Movie, Episode, ProviderError, __short_version__ from subliminal.exceptions import AuthenticationError, ConfigurationError, DownloadLimitExceeded, ProviderError @@ -62,6 +63,7 @@ class AssrtSubtitle(Subtitle): return self._detail params = {'token': self.token, 'id': self.id} logger.info('Get subtitle detail: GET /sub/detail %r', params) + sleep(3) r = self.session.get(server_url + '/sub/detail', params=params, timeout=10) r.raise_for_status() @@ -146,6 +148,7 @@ class AssrtProvider(Provider): params = {'token': self.token, 'q': query, 'is_file': 1} logger.debug('Searching subtitles: GET /sub/search %r', params) + sleep(3) res = self.session.get(server_url + '/sub/search', params=params, timeout=10) res.raise_for_status() result = res.json() @@ -176,6 +179,7 @@ class AssrtProvider(Provider): return self.query(languages, video) def download_subtitle(self, subtitle): + sleep(3) r = self.session.get(subtitle.download_link, timeout=10) r.raise_for_status() |