summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormorpheus65535 <[email protected]>2023-11-18 21:01:09 -0500
committermorpheus65535 <[email protected]>2023-11-18 21:01:09 -0500
commitb25d4164c296483958ecc951ff17b901a146a245 (patch)
tree16d73b9b50b4b35d9a4952eb925acdd9d2a72b20
parentd64d6b0a018bf40309a5baa80ec852ecb02820ae (diff)
downloadbazarr-b25d4164c296483958ecc951ff17b901a146a245.tar.gz
bazarr-b25d4164c296483958ecc951ff17b901a146a245.zip
Fixed infinite download retry loop in whisperai provider
-rw-r--r--bazarr/app/get_providers.py1
-rw-r--r--libs/subliminal_patch/core.py2
-rw-r--r--libs/subliminal_patch/providers/whisperai.py4
3 files changed, 4 insertions, 3 deletions
diff --git a/bazarr/app/get_providers.py b/bazarr/app/get_providers.py
index 026a20291..9ad4fd152 100644
--- a/bazarr/app/get_providers.py
+++ b/bazarr/app/get_providers.py
@@ -12,6 +12,7 @@ import requests
import traceback
import re
+from requests import ConnectionError
from subzero.language import Language
from subliminal_patch.exceptions import TooManyRequests, APIThrottled, ParseResponseError, IPAddressBlocked, \
MustGetBlacklisted, SearchLimitReached
diff --git a/libs/subliminal_patch/core.py b/libs/subliminal_patch/core.py
index 59312ee85..59cfd22a3 100644
--- a/libs/subliminal_patch/core.py
+++ b/libs/subliminal_patch/core.py
@@ -38,7 +38,7 @@ logger = logging.getLogger(__name__)
CUSTOM_PATHS = []
INCLUDE_EXOTIC_SUBS = True
-DOWNLOAD_TRIES = 0
+DOWNLOAD_TRIES = 3
DOWNLOAD_RETRY_SLEEP = 6
# fixme: this may be overkill
diff --git a/libs/subliminal_patch/providers/whisperai.py b/libs/subliminal_patch/providers/whisperai.py
index 8aef88bc0..7e1b62bbb 100644
--- a/libs/subliminal_patch/providers/whisperai.py
+++ b/libs/subliminal_patch/providers/whisperai.py
@@ -233,7 +233,7 @@ class WhisperAIProvider(Provider):
r = self.session.post(f"{self.endpoint}/detect-language",
params={'encode': 'false'},
files={'audio_file': out},
- timeout=self.timeout)
+ timeout=(5, self.timeout))
logger.info(f"Whisper detected language of {path} as {r.json()['detected_language']}")
@@ -290,6 +290,6 @@ class WhisperAIProvider(Provider):
r = self.session.post(f"{self.endpoint}/asr",
params={'task': subtitle.task, 'language': whisper_get_language_reverse(subtitle.audio_language), 'output': 'srt', 'encode': 'false'},
files={'audio_file': out},
- timeout=self.timeout)
+ timeout=(5, self.timeout))
subtitle.content = r.content