43 lines
1.3 KiB
Python
Executable File
43 lines
1.3 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
"""CLI helper to list and set voices for OpenCode and Claude tools."""
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
# Add project root to sys.path
|
|
here = Path(__file__).parent.parent
|
|
if str(here) not in sys.path:
|
|
sys.path.insert(0, str(here))
|
|
|
|
from voice_manager import KOKORO_VOICES, MACOS_VOICES, VoiceManager
|
|
|
|
def main():
|
|
workspace = Path.home() / "Workspace"
|
|
vm = VoiceManager(workspace)
|
|
|
|
if len(sys.argv) < 2 or sys.argv[1] in ("list", "ls", "--list"):
|
|
print("Available Voices:\n")
|
|
print("Kokoro Voices (On-Device Neural Speech):")
|
|
for k, v in KOKORO_VOICES.items():
|
|
active = " (ACTIVE)" if k == vm._active_voice else ""
|
|
print(f" - {k}: {v}{active}")
|
|
print("\nmacOS System Voices:")
|
|
for k, v in MACOS_VOICES.items():
|
|
active = " (ACTIVE)" if k == vm._active_voice else ""
|
|
print(f" - {k}: {v}{active}")
|
|
return
|
|
|
|
action = sys.argv[1]
|
|
if action in ("set", "change") and len(sys.argv) >= 3:
|
|
target_voice = sys.argv[2]
|
|
ok, msg = vm.apply_voice(target_voice)
|
|
print(msg)
|
|
else:
|
|
# Treat single argument as target voice
|
|
target_voice = sys.argv[1]
|
|
ok, msg = vm.apply_voice(target_voice)
|
|
print(msg)
|
|
|
|
if __name__ == "__main__":
|
|
main()
|