Skip to content

Commit

Permalink
Fixed infinite download retry loop in whisperai provider
Browse files Browse the repository at this point in the history
  • Loading branch information
morpheus65535 committed Nov 19, 2023
1 parent d64d6b0 commit b25d416
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions bazarr/app/get_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import traceback
import re

from requests import ConnectionError
from subzero.language import Language
from subliminal_patch.exceptions import TooManyRequests, APIThrottled, ParseResponseError, IPAddressBlocked, \
MustGetBlacklisted, SearchLimitReached
Expand Down
2 changes: 1 addition & 1 deletion libs/subliminal_patch/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
CUSTOM_PATHS = []
INCLUDE_EXOTIC_SUBS = True

DOWNLOAD_TRIES = 0
DOWNLOAD_TRIES = 3
DOWNLOAD_RETRY_SLEEP = 6

# fixme: this may be overkill
Expand Down
4 changes: 2 additions & 2 deletions libs/subliminal_patch/providers/whisperai.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ def detect_language(self, path) -> Language:
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']}")

Expand Down Expand Up @@ -290,6 +290,6 @@ def download_subtitle(self, subtitle: WhisperAISubtitle):
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

0 comments on commit b25d416

Please sign in to comment.