diff --git a/AGENTS.md b/AGENTS.md index 59e5574..0350610 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -8,6 +8,7 @@ They capture what was done, decisions & rationale, gotchas & fixes, and next ste | Date | Type | File | Summary | |------|------|------|---------| +| 2026-06-03 | issue | [20260603-issue10-documentation-site-and-readme_log.md](docs/devlog/20260603-issue10-documentation-site-and-readme_log.md) | **Issue #10 Complete:** MkDocs site (8 pages) + polished README. Material theme, flat URLs. **11/11 AC** · **172 tests pass** | | 2026-06-03 | slice | [20260603-slice-6b-summary-exit-codes-and-integration-tests-issue9_log.md](docs/devlog/20260603-slice-6b-summary-exit-codes-and-integration-tests-issue9_log.md) | **Issue #9 Complete:** Enhanced summary (failed/skipped book details) + graceful Ctrl+C (exit 130) + 3 integration tests. **12 new tests, 168 total** · **15/15 AC** | | 2026-06-03 | issue | [20260603-output-polish-progress-bars-and-failure-isolation-issue8_log.md](docs/devlog/20260603-output-polish-progress-bars-and-failure-isolation-issue8_log.md) | **Issue #8 Complete:** TTY-aware download reporting — rich progress bars (interactive) + plain log lines (cron). Per-book failure isolation. Content-Length → live %/ETA/speed. **18 new tests, 156 total** · **8/8 AC** | | 2026-06-03 | slice | [20260603-slice-5-accompanying-files-and-output-structure-issue7_log.md](docs/devlog/20260603-slice-5-accompanying-files-and-output-structure-issue7_log.md) | **Issue #7 Complete:** PDF extras + cover art download with config toggles, .partial→atomic rename, non-critical failure handling, output structure verification. **12 new tests, 134 total** · **11/11 AC** | diff --git a/CHANGELOG.md b/CHANGELOG.md index 6df7ca8..995c5d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Documentation +- **docs site (closes #10):** MkDocs documentation with 8 pages — Quickstart, + Configuration Reference, Secrets, Path Patterns, Format Strategies, CLI Usage, + and Troubleshooting. Material theme, flat URLs, all code snippets verified + against implementation. Polished README with badges, features table, format + comparison, and project comparison note. + ### Added - MP3 format fallback: download manifest fetch, ZIP part download+extraction with .partial tracking and resume, format strategy selector (m4b_mp3_fallback, diff --git a/README.md b/README.md index e9a3ecf..67ee9be 100644 --- a/README.md +++ b/README.md @@ -1 +1,80 @@ # librofm-downloader + +[](https://www.python.org/downloads/) +[](LICENSE.md) + +**Download owned audiobooks from your Libro.fm account** — a lightweight, dependency-minimal CLI tool written in Python. + +No Docker. No JVM. Just `pip install` and go. + +## Features + +- **Full library sync** — fetches every audiobook in your Libro.fm account with automatic pagination +- **M4B + MP3 formats** — downloads M4B (single file) or MP3 (ZIP parts extracted) with automatic fallback +- **Resume support** — interrupted downloads pick up where they left off via `.partial` files +- **Cover art & PDF extras** — optional download of cover images and accompanying PDFs +- **Customizable output paths** — token-based patterns for organizing your library on disk +- **TTY-aware progress** — rich progress bars in your terminal, clean log lines in cron jobs +- **Download history** — tracks what's been downloaded so re-runs only fetch new books +- **Graceful failure isolation** — one failed book doesn't stop the rest + +## Quick Start + +```bash +# 1. Install +pip install librofm-downloader + +# 2. Configure +cat > config.yaml << 'EOF' +librofm: + format: m4b_mp3_fallback + output_dir: ./audiobooks + download_extras: true + download_covers: true +EOF + +cat > secrets.yaml << 'EOF' +librofm: + username: your-email@example.com + password: your-password +EOF + +# 3. Run +librofm-downloader +``` + +## Documentation + +Full documentation is available at [**docs/**](docs/) (built with MkDocs): + +| Page | What it covers | +|------|---------------| +| [Quickstart](docs/quickstart.md) | Install, configure, run your first sync | +| [Configuration Reference](docs/configuration.md) | Every `config.yaml` / `secrets.yaml` field | +| [Secrets](docs/secrets.md) | Why credentials are separate, common mistakes | +| [Path Patterns](docs/path-patterns.md) | All tokens, default behavior, custom examples | +| [Format Strategies](docs/format-strategies.md) | `m4b_mp3_fallback` vs `mp3_only` vs `m4b_only` | +| [CLI Usage](docs/cli-usage.md) | Flags, exit codes, cron setup, TTY vs non-TTY | +| [Troubleshooting](docs/troubleshooting.md) | Common errors and solutions | + +## Format strategies + +Choose how audiobooks are downloaded via the `format` setting in `config.yaml`: + +| Strategy | Description | +|----------|-------------| +| `m4b_mp3_fallback` *(default)* | Try M4B first; fall back to MP3 if unavailable. Best for most users. | +| `mp3_only` | Download MP3 ZIP parts only. For players that don't support M4B. | +| `m4b_only` | Download M4B only; skip the book if unavailable. For single-file purists. | + +## Path customization + +Output paths follow a sensible default (`Author/Series/Book N Title` for series, `Author/Title` for standalones) but can be fully customized with tokens like `{FIRST_AUTHOR}`, `{BOOK_TITLE}`, `{SERIES_NAME}`, `{ISBN}`, `{PUBLICATION_YEAR}`, and more. See [Path Patterns](docs/path-patterns.md) for details. + +## Comparison + +This project is a **lightweight Python alternative** to the [Kotlin-based Docker container](https://github.com/advplyr/librofm-audiobook-downloader) that runs a full JVM. If you want something you can `pip install`, debug with standard Python tooling, and run without Docker — this is it. + +## License + +GPL-3.0. See [LICENSE.md](LICENSE.md). diff --git a/docs/devlog/20260603-issue10-documentation-site-and-readme_log.md b/docs/devlog/20260603-issue10-documentation-site-and-readme_log.md new file mode 100644 index 0000000..42c038d --- /dev/null +++ b/docs/devlog/20260603-issue10-documentation-site-and-readme_log.md @@ -0,0 +1,83 @@ +# Project Documentation Site and GitHub README — Issue #10 + +> **Date:** 2026-06-03 +> **Type:** issue +> **Reference:** [Issue #10](https://github.com/AlexKucera/librofm-downloader/issues/10) + +## Goal + +Build a complete MkDocs documentation site in `docs/` and polish the GitHub README.md — the final slice making the project usable, discoverable, and well-documented. All code snippets must match the actual implementation from slices 1–6b. + +## What Was Done + +### MkDocs site (8 pages + config) + +- **`docs/mkdocs/mkdocs.yml`** — Material theme with deep purple/amber palette, light/dark toggle, navigation tabs, code copy, TOC follow. Markdown extensions: admonition, highlight, superfences, tabbed, tables. Fixed pre-existing typo (`pymxdownx.tabbed` → `pymdownx.tabbed`). Set `use_directory_urls: false`, `site_dir: ../../docs/html`. +- **`docs/mkdocs/index.md`** — Landing page with Python 3.11+ badge, GPL-3.0 badge, one-paragraph description, feature list (8 bullets), 3-step quickstart, docs link table. +- **`docs/mkdocs/quickstart.md`** — Install (PyPI + source), configure (`config.yaml` + `secrets.yaml` with full examples), run (basic sync, TTY output example, non-TTY/cron output example, "nothing new" message), output directory structure tree. +- **`docs/mkdocs/configuration.md`** — File locations, secrets.yaml schema (2 fields), config.yaml schema (4 fields with types/defaults), full/minimal YAML examples, deep-merge explanation, validation error table (3 errors with fixes), download_history.json format and behavior. +- **`docs/mkdocs/secrets.md`** — Purpose, file format, why it's gitignored, 4 common mistakes (credentials in config, committed-before-gitignore, missing fields, wrong indentation), security notes (plaintext storage, HTTPS-only, 2FA note). +- **`docs/mkdocs/path-patterns.md`** — Default conditional logic (3 cases: standalone, series+num, series-no-num), subdirectory logic rules, full token registry table (12 tokens with source/example/notes), custom pattern setup, 4 pattern examples (flat-by-author, by-series, by-narrator, ISO-date-prefix), path sanitization rules (6 steps). +- **`docs/mkdocs/format-strategies.md`** — Overview table of 3 strategies, detailed sections for each (flow, output examples, when-to-use), decision flowchart, technical details for M4B downloads (8MB chunks, .partial→atomic rename, resume via Range) and MP3 downloads (manifest→ZIP parts→extract→cleanup). +- **`docs/mkdocs/cli-usage.md`** — Synopsis, options table (5 flags), `--verbose` output example, `--limit` explanation, exit codes (0/1/130) with scenarios, cron examples (3: basic daily, email-on-failure, weekly-with-limit), systemd timer unit files, TTY vs non-TTY auto-detection with output comparison. +- **`docs/mkdocs/troubleshooting.md`** — 12 issues across 6 categories: auth failures (401, non-401), config errors (credentials-in-config, missing-fields, invalid-format, file-not-found), download issues (interrupted/resume, per-book-failure, m4b_only-skip), history problems (corrupt-json, re-downloading), output/path issues (wrong-dir, permission-denied), performance (slow-downloads, large-library), getting-help checklist. + +### README.md + +- **`README.md`** — Rewritten with badges (Python 3.11+, GPL-3.0), description, feature list, quickstart code block, documentation page table (7 pages linked), format strategies comparison table, path customization blurb, "lightweight alternative to Kotlin Docker container" comparison note. + +### Build infrastructure + +- Installed mkdocs, mkdocs-material, pymdown-extensions into venv +- Restructured: moved all `.md` source files + `mkdocs.yml` + `stylesheets/` into `docs/mkdocs/` so that `site_dir` (`docs/html/`) is outside `docs_dir` +- Built HTML output to `docs/html/` with flat URLs (`use_directory_urls: false`) — pages are e.g., `configuration.html` not `configuration/index.html` + +## Decisions & Rationale + +| Decision | Rationale | +|----------|-----------| +| Material theme over readthedocs | Cleaner default look, built-in dark mode toggle, better navigation UX | +| Source in `docs/mkdocs/`, build to `docs/html/` | MkDocs refuses `site_dir` inside `docs_dir` (recursive copy risk). User explicitly requested this layout | +| `use_directory_urls: false` | User requested flat `.html` filenames instead of directory-based URLs | +| Code snippets verified against actual source | Every YAML example, CLI flag, exit code, token name, API endpoint, and error message cross-checked against `cli.py`, `config.py`, `client.py`, `downloader.py`, `history.py`, `progress.py` | +| LICENSE badge links to GitHub | `LICENSE.md` is outside `docs_dir`; relative link `../LICENSE.md` wouldn't resolve in built HTML; GitHub blob URL works universally | + +## Gotchas & Fixes + +| Problem | Root Cause | Fix | +|---------|------------|-----| +| `pymxdownx.tabbed` typo in existing mkdocs.yml | Pre-existing typo from earlier scaffolding | Corrected to `pymdownx.tabbed` | +| `mkdocs build -d docs/html/` refused | `site_dir` cannot be inside `docs_dir` — MkDocs detects this as recursive copy risk | Moved source files to `docs/mkdocs/`, set `docs_dir: .` and `site_dir: ../../docs/html` relative to `docs/mkdocs/` | +| Initial build to `/tmp/` then `cp -R` worked but user wanted proper structure | User explicitly asked for `docs/mkdocs/` source + `docs/html/` output layout | Restructured per user request | +| LICENSE.md link warning in build | Relative path `../LICENSE.md` resolved outside `docs_dir` | Changed to absolute GitHub URL | + +## Files Changed + +| File | Change Summary | +|------|---------------| +| `docs/mkdocs/mkdocs.yml` | MkDocs config — Material theme, nav, extensions, `use_directory_urls: false`, `site_dir: ../../docs/html`. Fixed `pymdownx` typo. | +| `docs/mkdocs/index.md` | Docs landing page — badges, features, quickstart, doc links | +| `docs/mkdocs/quickstart.md` | Install/config/run walkthrough with TTY + non-TTY output examples | +| `docs/mkdocs/configuration.md` | Full schema reference for config.yaml, secrets.yaml, history JSON | +| `docs/mkdocs/secrets.md` | Why secrets.yaml exists, 4 common mistakes, security notes | +| `docs/mkdocs/path-patterns.md` | 12 tokens, default logic, 4 custom pattern examples, sanitization rules | +| `docs/mkdocs/format-strategies.md` | 3 format strategies with flows, outputs, decision guide, technical details | +| `docs/mkdocs/cli-usage.md` | 5 CLI flags, 3 exit codes, 3 cron examples, systemd unit, TTY vs non-TTY | +| `docs/mkdocs/troubleshooting.md` | 12 issues across 6 categories with cause/fix for each | +| `README.md` | Polished README — badges, features, quickstart, docs table, format comparison, alt-project note | +| `docs/stylesheets/extra.css` | Moved into `docs/mkdocs/` (unchanged content) | +| `docs/html/` | Built HTML output (16 items, flat `.html` URLs) | + +## Open Items & Next Steps + +- None — Issue #10 acceptance criteria fully met: + - ✅ `mkdocs.yml` with working configuration + - ✅ `mkdocs build` succeeds without errors + - ✅ Quickstart, Configuration Reference, Path Patterns, Format Strategies, CLI Usage, Troubleshooting pages all present + - ✅ Secrets page included + - ✅ README.md polished with badges, description, features, quickstart, docs link + - ✅ All code snippets verified against actual implementation (172 tests still pass) + +--- + +*Log written by write-log skill* diff --git a/docs/html/404.html b/docs/html/404.html new file mode 100644 index 0000000..3817eb5 --- /dev/null +++ b/docs/html/404.html @@ -0,0 +1,750 @@ + + + +
+ + + + + + + + + + + + + + + + + + + + + +0&&i[i.length-1])&&(p[0]===6||p[0]===2)){r=0;continue}if(p[0]===3&&(!i||p[1]>i[0]&&p[1]=e.length&&(e=void 0),{value:e&&e[o++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function K(e,t){var r=typeof Symbol=="function"&&e[Symbol.iterator];if(!r)return e;var o=r.call(e),n,i=[],s;try{for(;(t===void 0||t-- >0)&&!(n=o.next()).done;)i.push(n.value)}catch(a){s={error:a}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(s)throw s.error}}return i}function B(e,t,r){if(r||arguments.length===2)for(var o=0,n=t.length,i;o