feat: forward language code and more config settings

This commit is contained in:
2026-01-30 20:12:48 +01:00
parent 76581db30b
commit e1a7b69f76
3 changed files with 91 additions and 12 deletions

View File

@@ -30,6 +30,17 @@ class MediaHandler:
except Exception:
return "0:a:0"
@staticmethod
def get_language_code(language_name: str) -> str:
"""Maps Bazarr language names to Whisper ISO codes."""
mapping = {
'english': 'en', 'french': 'fr', 'spanish': 'es',
'german': 'de', 'italian': 'it', 'portuguese': 'pt',
'dutch': 'nl', 'russian': 'ru', 'japanese': 'ja',
'chinese': 'zh'
}
return mapping.get(language_name.lower(), 'en')
@staticmethod
def extract_audio_chunk(media_path: str, start_sec: int, duration_sec: int, stream_index: str) -> str:
fd, tmp_name = tempfile.mkstemp(suffix=".wav")