Skip to content

UserScripts - #32

Merged
lbesnard merged 7 commits into
mainfrom
UserScripts
Jun 4, 2026
Merged

UserScripts#32
lbesnard merged 7 commits into
mainfrom
UserScripts

Conversation

@lbesnard

@lbesnard lbesnard commented Jun 4, 2026

Copy link
Copy Markdown
Owner
  • Add config management tools (discover-voices & manage-config)
  • Fix config tool design: remove Docker dependency from manage-config.py
  • Add flexible config directory resolution
  • Update docs: flexible config directory options
  • Improve argparse help text with clearer metavar names and resolution order
  • Add language menu and clean config template
  • docs: Update README with manage-config.py user setup instructions

lbesnard and others added 7 commits June 4, 2026 13:57
- scripts/discover-voices.py: Discovers available Piper TTS voices from Docker
  container and saves them to scripts/piper_voices.yaml organized by language
  and gender. Includes fallback list of 40+ known Piper voices.

- scripts/manage-config.py: Interactive CLI for user config management
  • add-user: Create new user with bcrypt password hashing
  • modify-user: Update existing user config
  • delete-user: Remove user with automatic tar.gz backup
  • list-users: Display registered users
  • discover-voices: Run voice discovery

- docs/CONFIG_MANAGEMENT.md: Comprehensive guide with examples,
  security best practices, and troubleshooting

- Update CONTEXT.md with User Config and Piper Voice definitions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The manage-config.py script is meant to run BEFORE the Docker container
starts, so it cannot depend on Docker being available. This commit fixes
the chicken-and-egg problem:

Changes:
- Remove discover-voices command from manage-config.py (menu and CLI)
- Remove discover_voices() method from ConfigManager
- manage-config.py now only reads piper_voices.yaml (static file)
- piper_voices.yaml is committed to the repository by developers

Voice discovery is now a separate, manual developer task:
- Run when Piper models are updated in the Docker image
- Executed inside the container: docker compose exec lingo-diary python scripts/discover-voices.py
- Results committed to piper_voices.yaml

Updates:
- README.md: Add 'Developer: Managing Piper Voices' section
- docs/CONFIG_MANAGEMENT.md: Update with correct developer workflow
- scripts/manage-config.py: Remove discover-voices references

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Implement proper priority-based config directory resolution:

1. -o/--output flag (overrides everything)
2. Parse docker-compose.yml to extract /app/.config/lingoDiary/ volume mount
3. Default fallback: ~/.config/efunk_lingo/lingoDiary/

Features:
- resolve_config_dir(): Main resolution logic with fallback chain
- extract_config_from_docker_compose(): Parses docker-compose.yml for
  the lingo-diary service and extracts host path from /app/.config/lingoDiary/
- Automatic ~ expansion using Path.expanduser()
- Auto-creates config directory and subdirectories
- Auto-creates users.yaml if missing
- ConfigManager now accepts config_dir as parameter

Command-line usage:
  python scripts/manage-config.py [command] [options]
  python scripts/manage-config.py add-user -o /custom/path
  python scripts/manage-config.py add-user -i /path/to/docker-compose.yml

This fixes the chicken-and-egg problem: script no longer depends on
Docker being available, and can work from any directory with flexible
config paths.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Document -i/--input and -o/--output flags with examples.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…order

- Replace bare flags with descriptive metavar: -i FILE, -o DIR
- Explain what INPUT (docker-compose.yml) and OUTPUT (config directory) refer to
- Add comprehensive epilog showing resolution priority and usage examples
- Make -h output more informative for new users

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Generate piper_voices.yaml with canonical language names (lowercase)
- Add LANGUAGE_NAMES mapping in discover-voices.py (en→english, no→norwegian, etc.)
- Replace free-form language input with numbered menu in manage-config.py
- Show current language with ● marker during modify-user flow
- Support language selection by number (1-11) or language code (en, no, etc.)
- Remove unused config keys: diary_entries_prompt_user, overwrite_diary_markdown,
  overwrite_tprs_markdown, overwrite_tprs_audio, create_tprs_auto, create_anki_deck
- Remove template_diary and template_tprs (unused legacy keys)
- Keep only active config: output_dir, create_diary_answers_auto, openai.*, gender, languages.*, tts.*

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace manual config creation with automated tool instructions
- Show three options: automated (recommended), custom dir, custom docker-compose path
- Add managing users section (list, modify, delete)
- Keep manual setup section for users who prefer it
- Remove redundant voice list (now in manage-config.py menus)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@lbesnard
lbesnard merged commit aa25102 into main Jun 4, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant