mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-04 05:52:24 +08:00
Fixed assrt provider to prevent making too many queries to the API. #1953
This commit is contained in:
parent
754fed4269
commit
0980af1060
1 changed files with 4 additions and 0 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Reference in a new issue