diff options
-rw-r--r-- | bazarr/app/config.py | 1 | ||||
-rw-r--r-- | bazarr/app/get_providers.py | 1 | ||||
-rw-r--r-- | custom_libs/subliminal_patch/providers/whisperai.py | 10 | ||||
-rw-r--r-- | frontend/src/pages/Settings/Providers/list.ts | 6 |
4 files changed, 16 insertions, 2 deletions
diff --git a/bazarr/app/config.py b/bazarr/app/config.py index 73eb6fd60..a5b1ff7e2 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -274,6 +274,7 @@ validators = [ Validator('whisperai.endpoint', must_exist=True, default='http://127.0.0.1:9000', is_type_of=str), Validator('whisperai.response', must_exist=True, default=5, is_type_of=int, gte=1), Validator('whisperai.timeout', must_exist=True, default=3600, is_type_of=int, gte=1), + Validator('whisperai.pass_video_name', must_exist=True, default=False, is_type_of=bool), Validator('whisperai.loglevel', must_exist=True, default='INFO', is_type_of=str, is_in=['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']), diff --git a/bazarr/app/get_providers.py b/bazarr/app/get_providers.py index 2fc9164f4..a649db423 100644 --- a/bazarr/app/get_providers.py +++ b/bazarr/app/get_providers.py @@ -330,6 +330,7 @@ def get_providers_auth(): 'timeout': settings.whisperai.timeout, 'ffmpeg_path': _FFMPEG_BINARY, 'loglevel': settings.whisperai.loglevel, + 'pass_video_name': settings.whisperai.pass_video_name, }, "animetosho": { 'search_threshold': settings.animetosho.search_threshold, diff --git a/custom_libs/subliminal_patch/providers/whisperai.py b/custom_libs/subliminal_patch/providers/whisperai.py index 73d259e84..c8535bd4f 100644 --- a/custom_libs/subliminal_patch/providers/whisperai.py +++ b/custom_libs/subliminal_patch/providers/whisperai.py @@ -233,7 +233,7 @@ class WhisperAIProvider(Provider): video_types = (Episode, Movie) - def __init__(self, endpoint=None, response=None, timeout=None, ffmpeg_path=None, loglevel=None): + def __init__(self, endpoint=None, response=None, timeout=None, ffmpeg_path=None, pass_video_name=None, loglevel=None): set_log_level(loglevel) if not endpoint: raise ConfigurationError('Whisper Web Service Endpoint must be provided') @@ -246,12 +246,16 @@ class WhisperAIProvider(Provider): if not ffmpeg_path: raise ConfigurationError("ffmpeg path must be provided") + + if pass_video_name is None: + raise ConfigurationError('Whisper Web Service Pass Video Name option must be provided') self.endpoint = endpoint.rstrip("/") self.response = int(response) self.timeout = int(timeout) self.session = None self.ffmpeg_path = ffmpeg_path + self.pass_video_name = pass_video_name def initialize(self): self.session = Session() @@ -369,9 +373,11 @@ class WhisperAIProvider(Provider): logger.info(f'Starting WhisperAI {subtitle.task} to {language_from_alpha3(output_language)} for {subtitle.video.original_path}') startTime = time.time() + video_name = subtitle.video.original_path if self.pass_video_name else None r = self.session.post(f"{self.endpoint}/asr", - params={'task': subtitle.task, 'language': input_language, 'output': 'srt', 'encode': 'false'}, + params={'task': subtitle.task, 'language': input_language, 'output': 'srt', 'encode': 'false', + 'video_file': {video_name}}, files={'audio_file': out}, timeout=(self.response, self.timeout)) diff --git a/frontend/src/pages/Settings/Providers/list.ts b/frontend/src/pages/Settings/Providers/list.ts index 3c300c735..ee345f18a 100644 --- a/frontend/src/pages/Settings/Providers/list.ts +++ b/frontend/src/pages/Settings/Providers/list.ts @@ -562,6 +562,12 @@ export const ProviderList: Readonly<ProviderInfo[]> = [ options: logLevelOptions, }, { + type: "switch", + key: "pass_video_name", + name: "Pass video filename to Whisper (for logging)", + defaultValue: false, + }, + { type: "testbutton", key: "whisperai", name: "Test Connection button", |