Slice 2: Config field, env var, and CLI flag for rename_chapters #33

Closed
opened 2026-06-05 15:03:45 +02:00 by AlexKucera · 1 comment
AlexKucera commented 2026-06-05 15:03:45 +02:00 (Migrated from github.com)

Parent

#19

What to build

Add rename_chapters configuration following the exact same pattern as the existing download_extras and download_covers boolean toggles.

End-to-end behavior: Users can control chapter renaming via three layers (CLI > env var > config file), all defaulting to enabled (True). The Config dataclass gains a new field; YAML config, environment, and CLI argparse all respect it.

Changes:

  • Config dataclass: Add rename_chapters: bool = True field
  • Config loader: Read rename_chapters from merged YAML dict in load_config()
  • Env var: RENAME_CHAPTERS (read in config loading layer)
  • CLI flag: --rename-chapters / --no-rename-chapters in argparse (cli.py)
  • Thread through: sync_run() accepts new param → passes to _download_fn closure → available when wiring into download pipeline (slice 3)

Follows established pattern from download_extras (issue #7) and workers (issue #12).

Acceptance criteria

  • Config.rename_chapters defaults to True
  • rename_chapters: false in config.yaml produces Config(rename_chapters=False)
  • RENAME_CHAPTERS=false env var overrides config file value
  • --no-rename-chapters CLI flag overrides both config and env var
  • --rename-chapters CLI flag explicitly enables it (for completeness)
  • Field threaded through sync_run() → _download_fn closure → ready for pipeline use
  • ~4 tests for config defaults, YAML reading, and CLI override

Blocked by

None - can start immediately (parallel with #32)

## Parent #19 ## What to build Add `rename_chapters` configuration following the exact same pattern as the existing `download_extras` and `download_covers` boolean toggles. **End-to-end behavior:** Users can control chapter renaming via three layers (CLI > env var > config file), all defaulting to enabled (`True`). The `Config` dataclass gains a new field; YAML config, environment, and CLI argparse all respect it. **Changes:** - **Config dataclass:** Add `rename_chapters: bool = True` field - **Config loader:** Read `rename_chapters` from merged YAML dict in `load_config()` - **Env var:** `RENAME_CHAPTERS` (read in config loading layer) - **CLI flag:** `--rename-chapters` / `--no-rename-chapters` in `argparse` (cli.py) - **Thread through:** `sync_run()` accepts new param → passes to `_download_fn` closure → available when wiring into download pipeline (slice 3) Follows established pattern from `download_extras` (issue #7) and `workers` (issue #12). ## Acceptance criteria - [ ] `Config.rename_chapters` defaults to `True` - [ ] `rename_chapters: false` in config.yaml produces `Config(rename_chapters=False)` - [ ] `RENAME_CHAPTERS=false` env var overrides config file value - [ ] `--no-rename-chapters` CLI flag overrides both config and env var - [ ] `--rename-chapters` CLI flag explicitly enables it (for completeness) - [ ] Field threaded through `sync_run()` → `_download_fn` closure → ready for pipeline use - [ ] ~4 tests for config defaults, YAML reading, and CLI override ## Blocked by None - can start immediately (parallel with #32)
AlexKucera commented 2026-06-05 17:15:40 +02:00 (Migrated from github.com)

✅ Complete: rename_chapters config field + --rename-chapters CLI flag. 5 new tests, 223 total passing. Committed as af5ad49 on feature/rename-mp3.

✅ Complete: `rename_chapters` config field + `--rename-chapters` CLI flag. 5 new tests, 223 total passing. Committed as `af5ad49` on `feature/rename-mp3`.
Sign in to join this conversation.