Added switch to control passing of video filename in whisper provider modal

development v1.4.6-beta.19
JayZed 3 days ago committed by GitHub
parent 48cdc8bfc8
commit e298d15724
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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']),

@ -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,

@ -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')
@ -247,11 +247,15 @@ 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))

@ -561,6 +561,12 @@ export const ProviderList: Readonly<ProviderInfo[]> = [
name: "Logging level",
options: logLevelOptions,
},
{
type: "switch",
key: "pass_video_name",
name: "Pass video filename to Whisper (for logging)",
defaultValue: false,
},
{
type: "testbutton",
key: "whisperai",

Loading…
Cancel
Save