-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp_settings.py
More file actions
59 lines (51 loc) · 1.69 KB
/
app_settings.py
File metadata and controls
59 lines (51 loc) · 1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
"""Application settings model for the desktop UI."""
from dataclasses import asdict, dataclass
import json
from pathlib import Path
@dataclass
class AppSettings:
"""
Persisted application settings for TTS generation and playback.
"""
voice: str = "en-US-GuyNeural"
speaking_rate: str = "medium"
synthesis_volume: str = "medium"
emphasis_level: str = "none"
pitch: str = "default"
pitch_range: str = "default"
pause_duration: str = "none"
pause_position: str = "after"
playback_volume: int = 80
auto_clean_text: bool = True
logging_enabled: bool = True
tts_provider: str = "azure"
azure_key: str = ""
azure_region: str = ""
gemini_config_path: str = ".gemini.env"
gemini_model: str = "gemini-2.5-flash-tts"
gemini_language_code: str = "en-US"
gemini_style_prompt: str = ""
local_tts_config_path: str = ".local_tts.env"
local_tts_driver_name: str = "auto"
polly_config_path: str = ".polly.env"
polly_engine: str = "neural"
output_dir: str = "data/dynamic/audio"
@classmethod
def load(cls, path):
"""
Load settings from disk, falling back to defaults if unavailable.
"""
settings_path = Path(path)
if not settings_path.exists():
return cls()
with open(settings_path, "r", encoding="utf-8") as file:
data = json.load(file)
return cls(**data)
def save(self, path):
"""
Save settings to disk.
"""
settings_path = Path(path)
settings_path.parent.mkdir(parents=True, exist_ok=True)
with open(settings_path, "w", encoding="utf-8") as file:
json.dump(asdict(self), file, indent=2)