|
|
@ -41,9 +41,9 @@ class GestdownSubtitle(Subtitle):
|
|
|
|
def _retry_on_423(method):
|
|
|
|
def _retry_on_423(method):
|
|
|
|
def retry(self, *args, **kwargs):
|
|
|
|
def retry(self, *args, **kwargs):
|
|
|
|
retries = 0
|
|
|
|
retries = 0
|
|
|
|
while 5 > retries:
|
|
|
|
while 3 > retries:
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
yield from method(self, *args, **kwargs)
|
|
|
|
return method(self, *args, **kwargs)
|
|
|
|
except HTTPError as error:
|
|
|
|
except HTTPError as error:
|
|
|
|
if error.response.status_code != 423:
|
|
|
|
if error.response.status_code != 423:
|
|
|
|
raise
|
|
|
|
raise
|
|
|
@ -52,10 +52,9 @@ def _retry_on_423(method):
|
|
|
|
|
|
|
|
|
|
|
|
logger.debug("423 returned. Retrying in 30 seconds")
|
|
|
|
logger.debug("423 returned. Retrying in 30 seconds")
|
|
|
|
time.sleep(30)
|
|
|
|
time.sleep(30)
|
|
|
|
else:
|
|
|
|
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
logger.debug("Retries limit exceeded. Ignoring query")
|
|
|
|
logger.debug("Retries limit exceeded. Ignoring query")
|
|
|
|
|
|
|
|
return []
|
|
|
|
|
|
|
|
|
|
|
|
return retry
|
|
|
|
return retry
|
|
|
|
|
|
|
|
|
|
|
@ -84,7 +83,6 @@ class GestdownProvider(Provider):
|
|
|
|
def terminate(self):
|
|
|
|
def terminate(self):
|
|
|
|
self._session.close()
|
|
|
|
self._session.close()
|
|
|
|
|
|
|
|
|
|
|
|
@_retry_on_423
|
|
|
|
|
|
|
|
def _subtitles_search(self, video, language: Language):
|
|
|
|
def _subtitles_search(self, video, language: Language):
|
|
|
|
json_data = {
|
|
|
|
json_data = {
|
|
|
|
"search": f"{video.series} S{video.season:02}E{video.episode:02}",
|
|
|
|
"search": f"{video.series} S{video.season:02}E{video.episode:02}",
|
|
|
@ -111,6 +109,7 @@ class GestdownProvider(Provider):
|
|
|
|
logger.debug("Found subtitle: %s", sub)
|
|
|
|
logger.debug("Found subtitle: %s", sub)
|
|
|
|
yield sub
|
|
|
|
yield sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@_retry_on_423
|
|
|
|
def list_subtitles(self, video, languages):
|
|
|
|
def list_subtitles(self, video, languages):
|
|
|
|
subtitles = []
|
|
|
|
subtitles = []
|
|
|
|
for language in languages:
|
|
|
|
for language in languages:
|
|
|
|