Cover parallel downloads, interactive selection (--select), chapter renaming (--rename-chapters), XDG config paths, Ctrl+C handling, and thread-safe history across all docs: index, quickstart, configuration, cli-usage, format-strategies, troubleshooting, and README.
5.4 KiB
Quickstart
Get librofm-downloader installed, configured, and running in three steps.
1. Install
From source
git clone https://github.com/AlexKucera/librofm-downloader.git
cd librofm-downloader
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
pip install -e .
Requires Python 3.11+.
For development (includes pytest):
pip install -e ".[dev]"
The [dev] extra installs pytest for testing — omit it if you only want to run the tool.
2. Configure
librofm-downloader uses two YAML files, searched in ~/.config/librofm-downloader/ first, then the current working directory:
| File | Purpose | Required? | Committed to git? |
|---|---|---|---|
config.yaml |
Preferences (format, output dir, toggles) | No (defaults used) | ✅ Yes |
secrets.yaml |
Credentials only | Yes | ❌ No (gitignored) |
Tip
The XDG directory (
~/.config/librofm-downloader/) is created automatically on first run. Place both files there to runlibrofm-downloaderfrom any directory.
config.yaml
# libro.fm downloader configuration
# This file is safe to commit — no credentials here.
# Credentials go in secrets.yaml (which is gitignored).
librofm:
# Audio format preference:
# m4b_mp3_fallback — try M4B first, fall back to MP3 ZIP (default)
# mp3_only — download MP3 ZIP only
# m4b_only — download M4B only, skip if unavailable
format: m4b_mp3_fallback
# Where downloaded audiobooks are saved
output_dir: ./audiobooks
# Whether to download PDF extras when available
download_extras: true
# Whether to download cover art when available
download_covers: true
# Whether to rename MP3 chapter files with titles from the manifest
# Only applies when format falls back to MP3 (m4b_mp3_fallback or mp3_only)
rename_chapters: true
# Number of parallel download workers (1 = sequential)
workers: 3
secrets.yaml
librofm:
username: your-email@example.com
password: your-password
Warning
Never commit
secrets.yaml. It is listed in.gitignoreby default. If you accidentally put credentials inconfig.yaml, the tool will refuse to start and tell you to move them.
3. Run
Basic sync
librofm-downloader
This:
- Searches for
config.yaml+secrets.yaml(XDG directory first, then CWD) - Authenticates with Libro.fm via OAuth2 password grant
- Fetches your full library (all pages)
- Skips books already in
download_history.json(XDG → CWD search) - Downloads each new book with up to 3 parallel workers
- Records successful downloads to history
Interactive selection
Pick which books to download from a checkbox list:
librofm-downloader --select
This:
- Fetches your library and filters already-downloaded books
- Presents a checkbox prompt (space to toggle, enter to confirm)
- Downloads only the books you selected
Note
--selectrequires an interactive terminal (TTY). In non-interactive environments (cron, pipes), the tool exits with an error.
When --select is active, --limit is superseded — you control exactly which books are downloaded.
First run output (TTY)
3 book(s) to download:
Brandon Sanderson - The Way of Kings ██████████████████████████ 100.0% 2.1 MB/s 00:01 45.2 MB
Author Two - Another Book ██████████████████████████ 100.0% 1.8 MB/s 00:02 120.5 MB
Author Three - Third Book ██████████████████████████ 100.0% 2.3 MB/s 00:00 89.1 MB
Summary: 3 downloaded, 0 skipped, 0 failed
Subsequent run (nothing new)
All caught up! No new books to download.
Cron / non-TTY output
When stdout is not a terminal (e.g., cron, piped), output switches to plain text log lines:
Downloading: Author One - Book Title One (unknown size)
Completed: Author One - Book Title One
Downloading: Author Two - Another Book (unknown size)
Completed: Author Two - Another Book
Summary: 2 downloaded, 0 skipped, 0 failed
Interrupted downloads
Press Ctrl+C to gracefully stop:
- First press: in-flight downloads drain to completion, then summary prints
- Second press: immediate hard exit
- Partial downloads (
.partialfiles) resume automatically on next run
What gets downloaded?
Files land under your output_dir using this structure:
audiobooks/
├── Brandon Sanderson/
│ ├── The Way of Kings/
│ │ ├── The Way of Kings.m4b
│ │ ├── cover.jpg
│ │ └── map.pdf
│ └── Words of Radiance.m4b ← no extras = flat file
└── Suzanne Collins/
└── The Hunger Games.m4b
- Books with cover art or PDF extras get a subdirectory (
Author/Title/) - Books without extras are flat files (
Author/Title.m4b) - When using MP3 format, chapter files are renamed with titles from the manifest (e.g.,
001 - Opening.mp3,002 - The Arrival.mp3) - See Path Patterns for customization options
Next steps
- Configuration Reference — every field documented
- Format Strategies — choose the right mode for your setup
- CLI Usage — all flags, exit codes, cron examples
- Troubleshooting — common problems and solutions