feat(config): pause_media_during_recording-Flag
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+10
-1
@@ -26,6 +26,7 @@ class Config:
|
||||
channels: int = 1
|
||||
min_duration: float = 0.5
|
||||
microphone: str = ""
|
||||
pause_media_during_recording: bool = True
|
||||
|
||||
|
||||
def load_config(path: Path = DEFAULT_CONFIG_PATH) -> Config:
|
||||
@@ -60,6 +61,12 @@ def load_config(path: Path = DEFAULT_CONFIG_PATH) -> Config:
|
||||
if "device" in audio_section:
|
||||
config.microphone = audio_section["device"]
|
||||
|
||||
media_section = data.get("media", {})
|
||||
if "pause_during_recording" in media_section:
|
||||
config.pause_media_during_recording = bool(
|
||||
media_section["pause_during_recording"]
|
||||
)
|
||||
|
||||
return config
|
||||
|
||||
|
||||
@@ -71,6 +78,7 @@ def _toml_str(value: str) -> str:
|
||||
def save_config(config: Config, path: Path = DEFAULT_CONFIG_PATH) -> None:
|
||||
"""Schreibt Config als TOML-Datei. Erstellt Verzeichnisse bei Bedarf."""
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
pause_media_str = "true" if config.pause_media_during_recording else "false"
|
||||
content = (
|
||||
f'[hotkey]\nkey = "{_toml_str(config.hotkey)}"\n\n'
|
||||
f'[whisper]\nmodel = "{_toml_str(config.whisper_model)}"\n'
|
||||
@@ -79,6 +87,7 @@ def save_config(config: Config, path: Path = DEFAULT_CONFIG_PATH) -> None:
|
||||
f'[audio]\nsample_rate = {config.sample_rate}\n'
|
||||
f'channels = {config.channels}\n'
|
||||
f'min_duration = {config.min_duration}\n'
|
||||
f'device = "{_toml_str(config.microphone)}"\n'
|
||||
f'device = "{_toml_str(config.microphone)}"\n\n'
|
||||
f'[media]\npause_during_recording = {pause_media_str}\n'
|
||||
)
|
||||
path.write_text(content, encoding="utf-8")
|
||||
|
||||
Reference in New Issue
Block a user