{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"],"fields":{"title":{"boost":1000.0},"text":{"boost":1.0},"tags":{"boost":1000000.0}}},"docs":[{"location":"index.html","title":"librofm-downloader","text":"
Download owned audiobooks from your Libro.fm account \u2014 a lightweight, dependency-minimal CLI tool written in Python.
No Docker. No JVM. Just pip install and go.
.partial files# 1. Install\npip install librofm-downloader\n\n# 2. Configure\ncat > config.yaml << 'EOF'\nlibrofm:\n format: m4b_mp3_fallback\n output_dir: ./audiobooks\n download_extras: true\n download_covers: true\nEOF\n\ncat > secrets.yaml << 'EOF'\nlibrofm:\n username: your-email@example.com\n password: your-password\nEOF\n\n# 3. Run\nlibrofm-downloader\n See Quickstart for the full walkthrough, or jump to Configuration Reference for every option.
"},{"location":"cli-usage.html","title":"CLI Usage","text":"Command-line interface reference for librofm-downloader.
librofm-downloader [OPTIONS]\n"},{"location":"cli-usage.html#options","title":"Options","text":"Option Short Default Description --config XDG \u2192 CWD search Path to config.yaml (overrides default search) --secrets XDG \u2192 CWD search Path to secrets.yaml (overrides default search) --history XDG \u2192 CWD search Path to download history JSON (overrides default search) -v, --verbose off Print extra detail (URLs, paths, API responses) --limit N 0 (no limit) Maximum number of books to download -w, --workers N 3 Number of parallel download workers (1 = sequential)"},{"location":"cli-usage.html#-verbose","title":"--verbose","text":"Shows internal pipeline state at each stage:
\u2500\u2500 config \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n config: ~/.config/librofm-downloader/config.yaml\n secrets: ~/.config/librofm-downloader/secrets.yaml\n history: ~/.config/librofm-downloader/download_history.json\n format: m4b_mp3_fallback\n output: ./audiobooks\n extras: True\n covers: True\n user: me@example.com\n\u2500\u2500 auth \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n \u2713 authenticated\n\u2500\u2500 library \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 47 book(s) in library\n\u2500\u2500 filtering \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n 42 already downloaded, 5 new\n \u2b07 Book Title [dim](9780743565400)[/dim]\n authors: Brandon Sanderson\n narrators: Kate Reading, Michael Kramer\n ...\n 123,456,789 bytes\n"},{"location":"cli-usage.html#-limit","title":"--limit","text":"Cap how many books are downloaded in a single run. Useful for testing:
# Download only 1 book (the first new one)\nlibrofm-downloader --limit 1\n\n# Download up to 3 books\nlibrofm-downloader --limit 3 -v\n Books are processed in the order returned by the Libro.fm API. Already-downloaded books are filtered out before the limit is applied.
"},{"location":"cli-usage.html#-workers","title":"--workers","text":"Controls how many books download simultaneously:
# Default: 3 parallel downloads\nlibrofm-downloader\n\n# High-bandwidth connection: 5 workers\nlibrofm-downloader -w 5\n\n# Force sequential (useful for debugging)\nlibrofm-downloader --workers 1\n Resolution order (CLI > config > default):
--workers N / -w N on the command lineworkers: field in config.yaml[!NOTE] The worker count controls CDN download parallelism. Libro.fm API calls are separately capped at 3 concurrent requests via an internal semaphore, regardless of worker count. This protects the API server while letting CDN transfers scale up.
Set to 1 for behavior identical to the pre-parallelism sequential mode.
0 Success \u2014 all done (including \"nothing new to download\") 1 Fatal error \u2014 config problem, auth failure, or library fetch failure 130 Interrupted \u2014 user pressed Ctrl+C during downloads"},{"location":"cli-usage.html#exit-code-0-scenarios","title":"Exit code 0 scenarios","text":"All caught up!)[!NOTE] Exit code 0 does not mean \"zero failures\" \u2014 it means the process ran to completion. Check the summary line for failed count.
# Config error\n$ librofm-downloader --config missing.yaml\nConfig error: [Errno 2] No such file or directory: 'missing.yaml'\n\n# Auth failure\n$ librofm-downloader\nAuthentication failed: Auth failed (401)\n\n# Library fetch failure\n$ librofm-downloader\nFailed to fetch library: 502 Bad Gateway\n"},{"location":"cli-usage.html#exit-code-130","title":"Exit code 130","text":"$ librofm-downloader\n^CDownload interrupted by user (Ctrl+C).\necho $?\n130\n Partial downloads are preserved as .partial files and will be resumed on the next run.
# m h dom mon dow command\n0 4 * * * cd /path/to/librofm-downloader && .venv/bin/librofm-downloader >> /var/log/librofm.log 2>&1\n Runs every day at 4:00 AM, appends output to a log file.
"},{"location":"cli-usage.html#with-email-on-failure","title":"With email on failure","text":"0 4 * * * cd /path/to/librofm-downloader && .venv/bin/librofm-downloader || echo \"librofm-downloader failed\" | mail -s \"DL failure\" you@example.com\n"},{"location":"cli-usage.html#weekly-with-limit","title":"Weekly with limit","text":"0 3 * * 1 cd /path/to/librofm-downloader && .venv/bin/librofm-downloader --limit 10 >> /var/log/librofm-weekly.log 2>&1\n Runs Mondays at 3:00 AM, caps at 10 books.
"},{"location":"cli-usage.html#systemd-timer-alternative-to-cron","title":"systemd timer (alternative to cron)","text":"# /etc/systemd/system/librofm-downloader.service\n[Unit]\nDescription=Libro.fm Audiobook Downloader\nAfter=network-online.target\n\n[Service]\nType=oneshot\nWorkingDirectory=/path/to/librofm-downloader\nExecStart=/path/to/librofm-downloader/.venv/bin/librofm-downloader\n\n# /etc/systemd/system/librofm-downloader.timer\n[Unit]\nDescription=Run librofm-downloader daily\n\n[Timer]\nOnCalendar=daily\nPersistent=true\n\n[Install]\nWantedBy=timers.target\n systemctl enable --now librofm-downloader.timer\njournalctl -u librofm-downloader -f\n"},{"location":"cli-usage.html#tty-vs-non-tty-output","title":"TTY vs non-TTY output","text":"The tool auto-detects whether stdout is a terminal:
"},{"location":"cli-usage.html#tty-interactive-terminal","title":"TTY (interactive terminal)","text":"Brandon Sanderson - The Way of Kings \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 67.3% 2.1 MB/s 00:03 45.2 MB\n"},{"location":"cli-usage.html#non-tty-cron-pipe-redirect","title":"Non-TTY (cron, pipe, redirect)","text":"Downloading: Brandon Sanderson - The Way of Kings (unknown size)\nCompleted: Brandon Sanderson - The Way of Kings\nSummary: 1 downloaded, 0 skipped, 0 failed\n This means you get nice progress in your terminal and clean logs in cron \u2014 no flags needed.
"},{"location":"configuration.html","title":"Configuration Reference","text":"Complete reference for config.yaml, secrets.yaml, and download history.
When no --config, --secrets, or --history flags are provided, the tool searches for each file in this order:
~/.config/librofm-downloader/The XDG directory is created automatically on first run if it doesn't exist. This means you can drop your files into ~/.config/librofm-downloader/ and run librofm-downloader from any directory.
~/.config/librofm-downloader/\n\u251c\u2500\u2500 config.yaml # optional \u2014 built-in defaults used if missing\n\u251c\u2500\u2500 secrets.yaml # required \u2014 tool exits with an error if missing\n\u2514\u2500\u2500 download_history.json # created automatically on first download\n"},{"location":"configuration.html#missing-files-config-vs-secrets","title":"Missing files: config vs secrets","text":"The two config files have different missing-file behavior:
File If missing Behaviorconfig.yaml Non-fatal Tool runs with built-in defaults (m4b_mp3_fallback, ./audiobooks, etc.). A notice is printed listing searched paths. secrets.yaml Fatal Tool exits with code 1 and an error listing both searched locations so you know where to create it."},{"location":"configuration.html#overriding-with-cli-flags","title":"Overriding with CLI flags","text":"Use --config, --secrets, and --history to bypass the XDG\u2192CWD search entirely and point at specific files:
# Use files in a custom location\nlibrofm-downloader --config /path/to/config.yaml --secrets /path/to/secrets.yaml\n\n# Custom history file\nlibrofm-downloader --history /path/to/download_history.json\n When a flag is provided, that path is used directly \u2014 no search is performed.
Both config files share the same top-level key: librofm.
Credentials only. This file must not be committed to version control.
Field Type Required Descriptionusername string \u2705 Your Libro.fm account email password string \u2705 Your Libro.fm password librofm:\n username: your-email@example.com\n password: your-password\n [!IMPORTANT] Only username and password belong in this file. All other settings go in config.yaml. If either field is missing, the tool exits with code 1 and an error message.
All non-credential settings. Safe to commit. Optional \u2014 if missing, built-in defaults are used.
Field Type Default Descriptionformat string \"m4b_mp3_fallback\" Audio download strategy. See Format Strategies. output_dir string \"./audiobooks\" Base directory for downloaded files. Relative paths resolve from CWD. download_extras boolean true Download PDF extras (e.g., maps) when available. download_covers boolean true Download cover art (JPEG/PNG) when available. workers integer 3 Number of parallel download threads. Set to 1 for sequential mode. Must be \u2265 1."},{"location":"configuration.html#full-example","title":"Full example","text":"librofm:\n format: m4b_mp3_fallback\n output_dir: ./audiobooks\n download_extras: true\n download_covers: true\n workers: 3\n"},{"location":"configuration.html#minimal-example","title":"Minimal example","text":"Only format is meaningful here \u2014 everything else has a default:
librofm:\n format: mp3_only\n workers: 5 # high-bandwidth connection\n"},{"location":"configuration.html#how-merging-works","title":"How merging works","text":"config.yaml and secrets.yaml are deep-merged at startup:
config.yaml is loaded as the basesecrets.yaml is layered on top (overrides on conflict)This means you could theoretically put any field in either file \u2014 but credentials in config.yaml are explicitly rejected at load time with a clear error:
Config error: Credentials (username, password) found in config.yaml.\nMove them to secrets.yaml (which is gitignored).\n"},{"location":"configuration.html#validation-errors","title":"Validation errors","text":"Error Cause Fix Config error: Credentials (...) found in config.yaml Username or password in config file Move to secrets.yaml Missing required fields in secrets.yaml: username Missing credential field Add it to secrets.yaml Invalid format 'foo' Unknown format value Use one of: m4b_mp3_fallback, mp3_only, m4b_only config.yaml not found in ~/.config/.../config.yaml \u2192 ./config.yaml. Using built-in defaults. No config file in either location Non-fatal \u2014 defaults used. Create config.yaml to customize. Missing secrets.yaml. Searched: ~/.config/.../secrets.yaml \u2192 ./secrets.yaml. No secrets file in either location Create secrets.yaml with your credentials in one of the searched locations. Invalid workers value: 0 Workers < 1 Set workers to an integer \u2265 1"},{"location":"configuration.html#download-history","title":"Download history","text":"A third file, download_history.json, tracks what's been downloaded. It follows the same XDG\u2192CWD search order as the config files, and defaults to the XDG directory when not found anywhere:
~/.config/librofm-downloader/download_history.json\n The file is created automatically on first download. Override with --history to use a custom location.
{\n \"9780743565400\": {\n \"isbn\": \"9780743565400\",\n \"title\": \"The Way of Kings\",\n \"format\": \"m4b\",\n \"path\": \"./audiobooks/Brandon Sanderson/The Way of Kings/The Way of Kings.m4b\",\n \"downloaded_at\": \"2026-06-03T10:30:00+00:00\"\n }\n}\n librofm-downloader supports three audio format strategies, controlled by the format field in config.yaml.
m4b_mp3_fallback Try M4B first; fall back to MP3 if unavailable Default \u2014 maximum compatibility mp3_only Download MP3 ZIP only (skip M4B entirely) Players that don't support M4B m4b_only Download M4B only; skip book if unavailable Audiobook apps that prefer M4B"},{"location":"format-strategies.html#m4b_mp3_fallback-default","title":"m4b_mp3_fallback (default)","text":"The recommended strategy for most users.
librofm:\n format: m4b_mp3_fallback\n Flow:
.m4b fileWhat you get:
.m4b file (AAC/ALAC audio, bookmarkable, chapter markers)Output examples:
# M4B succeeded\naudiobooks/Brandon Sanderson/The Way of Kings.m4b # single file, ~450 MB\n\n# Fell back to MP3\naudiobooks/Some Author/Old Book/ # directory with MP3s\n\u251c\u2500\u2500 part1.mp3\n\u251c\u2500\u2500 part2.mp3\n\u2514\u2500\u2500 part3.mp3\n"},{"location":"format-strategies.html#mp3_only","title":"mp3_only","text":"Skip M4B entirely and always use the MP3 ZIP pipeline.
librofm:\n format: mp3_only\n Flow:
When to use this:
Output: Always a directory with extracted MP3 files:
audiobooks/Brandon Sanderson/The Way of Kings/\n\u251c\u2500\u2500 part1.mp3\n\u251c\u2500\u2500 part2.mp3\n\u2514\u2500\u2500 ...\n"},{"location":"format-strategies.html#m4b_only","title":"m4b_only","text":"Only attempt M4B download. Skip books where M4B is not available.
librofm:\n format: m4b_only\n Flow:
.m4b fileWhen to use this:
Output example:
# Success\naudiobooks/Brandon Sanderson/The Way of Kings.m4b\n\n# Skipped (shows in summary)\nSummary: 5 downloaded, 2 skipped, 0 failed\n Skipped:\n \u23ed Some Author - Old Book [9781234567890]\n"},{"location":"format-strategies.html#how-to-choose","title":"How to choose","text":"\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\u2502\n\u2502 Want every book? \u2502 \u2192 m4b_mp3_fallback (default) \u2502\n\u2502 Only need MP3? \u2502 \u2192 mp3_only \u2502\n\u2502 Single-file or nothing? \u2502 \u2192 m4b_only \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n"},{"location":"format-strategies.html#technical-details","title":"Technical details","text":""},{"location":"format-strategies.html#m4b-downloads","title":"M4B downloads","text":"{title}.m4b.partial during transfer.m4b on completion.partial file exists, sends Range header to continueContent-Length header (% complete, speed, ETA)/api/v10/download-manifest?isbn=...) listing ZIP part URLs.zip.partial file, then renamed to .zipRange headersHow librofm-downloader organizes files on disk, and how to customize the layout with tokens.
"},{"location":"path-patterns.html#default-behavior","title":"Default behavior","text":"When no custom pattern is set, the output path is determined by conditional logic based on whether a book belongs to a series:
"},{"location":"path-patterns.html#standalone-book-no-series","title":"Standalone book (no series)","text":"{FIRST_AUTHOR}/{BOOK_TITLE}\n Example: Brandon Sanderson/The Way of Kings.m4b
{FIRST_AUTHOR}/{SERIES_NAME}/Book {SERIES_NUM} {BOOK_TITLE}\n Example: Brandon Sanderson/Stormlight Archive/Book 1 The Way of Kings.m4b
{FIRST_AUTHOR}/{SERIES_NAME}/{BOOK_TITLE}\n Example: J.K. Rowling/Harry Potter/Harry Potter and the Sorcerer's Stone.m4b
A book gets its own subdirectory when any of these are true:
pdf_extras: true)download_covers: true and the book has a cover URLOtherwise the audio file sits directly under the author directory as a flat file.
"},{"location":"path-patterns.html#available-tokens","title":"Available tokens","text":"Use these inside {TOKEN} placeholders in a custom pattern:
{FIRST_AUTHOR} First item in authors list Brandon Sanderson Empty if no authors {ALL_AUTHORS} Authors joined by , Sanderson, Brandon Empty if no authors {SERIES_NAME} Series name Stormlight Archive Empty string if not in a series {SERIES_NUM} Series position integer 1 Empty if not in a series or no number {BOOK_TITLE} Book title The Way of Kings Sanitized for filesystem safety {ISBN} ISBN identifier 9780743565400 As returned by the API {FIRST_NARRATOR} First narrator Kate Reading Empty if no narrators {ALL_NARRATORS} Narrators joined by , Kate Reading, Michael Kramer Empty if no narrators {PUBLICATION_YEAR} Year published 2024 Empty if unknown {PUBLICATION_MONTH} Month published 8 Empty if unknown {PUBLICATION_DAY} Day published 15 Empty if unknown"},{"location":"path-patterns.html#custom-patterns","title":"Custom patterns","text":"To override the default conditional logic, set a path_pattern key in your config:
librofm:\n format: m4b_mp3_fallback\n output_dir: ./audiobooks\n path_pattern: \"{PUBLICATION_YEAR}/{FIRST_AUTHOR} - {BOOK_TITLE}\"\n This would produce paths like:
./audiobooks/2024/Brandon Sanderson - The Way of Kings.m4b\n./audiobooks/2023/Suzanne Collins - The Hunger Games.m4b\n [!NOTE] Custom patterns are applied via regex substitution ({TOKEN_NAME} \u2192 value). Unknown tokens resolve to empty strings \u2014 no error is raised. Each path component is sanitized (colons replaced, illegal chars stripped, capped at 255 chars).
path_pattern: \"{ALL_AUTHORS}/{BOOK_TITLE}\"\n Output:
audiobooks/Sanderson, Brandon/The Way of Kings.m4b\naudiobooks/Collins, Suzanne/The Hunger Games.m4b\n"},{"location":"path-patterns.html#organized-by-series","title":"Organized by series","text":"path_pattern: \"{FIRST_AUTHOR}/{SERIES_NAME}/{SERIES_NUM:03d} - {BOOK_TITLE}\"\n Output:
audiobooks/Brandon Sanderson/Stormlight Archive/001 - The Way of Kings.m4b\naudiobooks/Brandon Sanderson/Mistborn/001 - The Final Empire.m4b\n [!WARNING] Python format specs like :03d are not supported \u2014 tokens produce plain strings only. Use {SERIES_NUM} directly; it will render as 1, 2, etc.
path_pattern: \"{FIRST_NARRATOR}/{BOOK_TITLE}\"\n Output:
audiobooks/Kate Reading/The Way of Kings.m4b\n"},{"location":"path-patterns.html#iso-style-date-prefix","title":"ISO-style date prefix","text":"path_pattern: \"{PUBLICATION_YEAR}-{PUBLICATION_MONTH}-{PUBLICATION_DAY}/{FIRST_AUTHOR}/{BOOK_TITLE}\"\n Output:
audiobooks/2024-8-15/Brandon Sanderson/The Way of Kings.m4b\n"},{"location":"path-patterns.html#path-sanitization","title":"Path sanitization","text":"Every path component goes through sanitization before being written to disk:
:) \u2192 replaced with -< > / \\ | ? * \u2192 strippedPreserved characters include dashes, commas, apostrophes, parentheses, and non-trailing periods.
"},{"location":"quickstart.html","title":"Quickstart","text":"Get librofm-downloader installed, configured, and running in three steps.
"},{"location":"quickstart.html#1-install","title":"1. Install","text":""},{"location":"quickstart.html#from-pypi-recommended","title":"From PyPI (recommended)","text":"pip install librofm-downloader\n Requires Python 3.11+.
"},{"location":"quickstart.html#from-source","title":"From source","text":"git clone https://github.com/AlexKucera/librofm-downloader.git\ncd librofm-downloader\npython -m venv .venv\nsource .venv/bin/activate # or .venv\\Scripts\\activate on Windows\npip install -e \".[dev]\"\n The [dev] extra installs pytest for testing \u2014 omit it if you only want to run the tool.
librofm-downloader uses two YAML files, searched in ~/.config/librofm-downloader/ first, then the current working directory:
config.yaml Preferences (format, output dir, toggles) No (defaults used) \u2705 Yes secrets.yaml Credentials only Yes \u274c No (gitignored) [!TIP] The XDG directory (~/.config/librofm-downloader/) is created automatically on first run. Place both files there to run librofm-downloader from any directory.
# libro.fm downloader configuration\n# This file is safe to commit \u2014 no credentials here.\n# Credentials go in secrets.yaml (which is gitignored).\n\nlibrofm:\n # Audio format preference:\n # m4b_mp3_fallback \u2014 try M4B first, fall back to MP3 ZIP (default)\n # mp3_only \u2014 download MP3 ZIP only\n # m4b_only \u2014 download M4B only, skip if unavailable\n format: m4b_mp3_fallback\n\n # Where downloaded audiobooks are saved\n output_dir: ./audiobooks\n\n # Whether to download PDF extras when available\n download_extras: true\n\n # Whether to download cover art when available\n download_covers: true\n"},{"location":"quickstart.html#secretsyaml","title":"secrets.yaml","text":"librofm:\n username: your-email@example.com\n password: your-password\n [!WARNING] Never commit secrets.yaml. It is listed in .gitignore by default. If you accidentally put credentials in config.yaml, the tool will refuse to start and tell you to move them.
librofm-downloader\n This:
config.yaml + secrets.yaml (XDG directory first, then CWD)download_history.json (XDG \u2192 CWD search)3 book(s) to download:\n\nAuthor One - Book Title One \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100.0% 2.1 MB/s 00:01 45.2 MB\n \u2713 Book Title One\nAuthor Two - Another Book \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100.0% 1.8 MB/s 00:02 120.5 MB\n \u2713 Another Book\nAuthor Three - Third Book \u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588 100.0% 2.3 MB/s 00:00 89.1 MB\n \u2713 Third Book\n\nSummary: 3 downloaded, 0 skipped, 0 failed\n"},{"location":"quickstart.html#subsequent-run-nothing-new","title":"Subsequent run (nothing new)","text":"All caught up! No new books to download.\n"},{"location":"quickstart.html#cron-non-tty-output","title":"Cron / non-TTY output","text":"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)\nCompleted: Author One - Book Title One\nDownloading: Author Two - Another Book (unknown size)\nCompleted: Author Two - Another Book\n\nSummary: 2 downloaded, 0 skipped, 0 failed\n"},{"location":"quickstart.html#what-gets-downloaded","title":"What gets downloaded?","text":"Files land under your output_dir using this structure:
audiobooks/\n\u251c\u2500\u2500 Brandon Sanderson/\n\u2502 \u251c\u2500\u2500 The Way of Kings/\n\u2502 \u2502 \u251c\u2500\u2500 The Way of Kings.m4b\n\u2502 \u2502 \u251c\u2500\u2500 cover.jpg\n\u2502 \u2502 \u2514\u2500\u2500 map.pdf\n\u2502 \u2514\u2500\u2500 Words of Radiance.m4b \u2190 no extras = flat file\n\u2514\u2500\u2500 Suzanne Collins/\n \u2514\u2500\u2500 The Hunger Games.m4b\n Author/Title/)Author/Title.m4b)Why secrets.yaml exists, how it works, and common mistakes to avoid.
Libro.fm authentication requires your email and password. These are stored in a separate file from your regular configuration so you can safely commit config.yaml to version control without leaking credentials.
librofm:\n username: your-email@example.com\n password: your-password\n Two fields, both required, both strings. That's it.
"},{"location":"secrets.html#why-its-gitignored","title":"Why it's gitignored","text":"The .gitignore entry:
secrets.yaml\n This is set up by default in the project template. If you clone the repo and create secrets.yaml, Git will never track it.
If you accidentally add username or password to config.yaml:
# \u274c Wrong \u2014 config.yaml\nlibrofm:\n username: me@example.com # <-- this will be rejected\n password: secret # <-- this will be rejected\n format: m4b_mp3_fallback\n The tool refuses to start:
Config error: Credentials (username, password) found in config.yaml.\nMove them to secrets.yaml (which is gitignored).\n Fix: Remove those lines from config.yaml and put them in secrets.yaml.
If you git add secrets.yaml before the .gitignore rule was added, Git may already be tracking it:
# Check if Git is tracking it\ngit ls-files | grep secrets.yaml\n\n# If it shows up, remove it from tracking (keeps local file)\ngit rm --cached secrets.yaml\ngit commit -m \"Stop tracking secrets.yaml\"\n"},{"location":"secrets.html#3-missing-fields","title":"3. Missing fields","text":"If secrets.yaml exists but is missing username or password:
Missing required fields in secrets.yaml: username, password.\nAdd them to your secrets.yaml file.\n Both fields are required \u2014 there are no defaults for credentials.
"},{"location":"secrets.html#4-wrong-indentation","title":"4. Wrong indentation","text":"YAML is whitespace-sensitive. The librofm: key must be at column 0, and username/password must be indented with exactly 2 spaces:
# \u2705 Correct\nlibrofm:\n username: me@example.com\n password: secret\n\n# \u274c Wrong \u2014 no indentation\nlibrofm:\nusername: me@example.com\npassword: secret\n\n# \u274c Wrong \u2014 wrong key name (not under librofm:)\nusername: me@example.com\npassword: secret\n"},{"location":"secrets.html#security-notes","title":"Security notes","text":"secrets.yaml file \u2014 if you do, rotate your Libro.fm password immediatelyCommon errors, their causes, and how to fix them.
"},{"location":"troubleshooting.html#authentication-failures","title":"Authentication failures","text":""},{"location":"troubleshooting.html#authentication-failed-auth-failed-401","title":"\"Authentication failed: Auth failed (401)\"","text":"Cause: Wrong email or password in secrets.yaml.
Fix:
secrets.yaml (YAML is case-sensitive)secrets.yamlCause: Network issue or Libro.fm API temporarily down.
Fix:
Cause: You put username or password in config.yaml instead of secrets.yaml.
Fix: Remove those lines from config.yaml. They belong only in secrets.yaml. See Secrets.
Cause: secrets.yaml is missing a required field.
Fix: Add both username and password under the librofm: key:
librofm:\n username: your-email@example.com\n password: your-password\n"},{"location":"troubleshooting.html#invalid-format-xyz","title":"\"Invalid format 'xyz'\"","text":"Cause: The format value in config.yaml is not one of the three valid strategies.
Fix: Use one of:
m4b_mp3_fallbackmp3_onlym4b_onlyCause: The config file doesn't exist at the specified path.
Fix:
# Option 1: Place files in the XDG directory (recommended)\nmkdir -p ~/.config/librofm-downloader\ncp config.yaml secrets.yaml ~/.config/librofm-downloader/\n\n# Option 2: Run from the directory that contains config.yaml\ncd /path/to/your/project\n\n# Option 3: Specify paths explicitly\nlibrofm-downloader --config /path/to/config.yaml --secrets /path/to/secrets.yaml\n"},{"location":"troubleshooting.html#download-issues","title":"Download issues","text":""},{"location":"troubleshooting.html#download-stops-partway-through","title":"Download stops partway through","text":"Cause: Network interruption, timeout, or you pressed Ctrl+C.
Behavior: - Exit code 130 if Ctrl+C - Partial file saved as {filename}.m4b.partial or {filename}.zip.partial
Fix \u2014 resume on next run: The tool automatically detects .partial files and sends an HTTP Range header to resume from where it stopped. Just run again:
librofm-downloader\n"},{"location":"troubleshooting.html#failed-author-title-isbn-connection-error","title":"\"Failed: Author - Title [ISBN] (connection error)\"","text":"Cause: Intermittent network failure during a single book's download.
Behavior: - That book is marked as failed in the summary - All other books continue downloading normally - Exit code is still 0 (pipeline completed)
Fix: Run again \u2014 the failed book will be retried (it wasn't recorded in history since it didn't complete):
$ librofm-downloader\nSummary: 0 downloaded, 0 skipped, 1 failed\n Failed:\n \u2717 Brandon Sanderson - The Way of Kings [9780743565400] (connection error)\n\n# Run again \u2014 it will retry the failed book\n$ librofm-downloader\n"},{"location":"troubleshooting.html#book-shows-as-skipped-with-m4b_only-mode","title":"Book shows as skipped with m4b_only mode","text":"Cause: The book has no M4B format available from Libro.fm (API returns 404).
Behavior: - Book appears under Skipped: in summary - Not written to download history
Fix options: - Switch to m4b_mp3_fallback to get the MP3 version instead - Accept that some books aren't available in M4B format
Cause: The download_history.json file exists but contains invalid JSON.
Behavior: - Tool starts with empty history (all books appear as \"new\") - Already-downloaded books will be re-downloaded
Fix:
# Option 1: Delete and let it rebuild\nrm ~/.config/librofm-downloader/download_history.json\nlibrofm-downloader\n\n# Option 2: If using CWD-based history\nrm download_history.json\nlibrofm-downloader\n\n# Option 3: Fix the JSON manually (if you know what's in there)\n# Check for trailing commas, missing braces, etc.\n"},{"location":"troubleshooting.html#books-re-downloading-after-already-being-downloaded","title":"Books re-downloading after already being downloaded","text":"Cause: The ISBN in the library response doesn't match what's stored in history.
Check:
# See what's recorded (XDG location)\ncat ~/.config/librofm-downloader/download_history.json | python -m json.tool\n\n# Or if using CWD-based history\ncat download_history.json | python -m json.tool\n\n# Look for the ISBN of the book that's re-downloading\n Possible reasons: - The book was re-published under a new ISBN - History file was deleted or moved - You're running from a different directory with a different history file
"},{"location":"troubleshooting.html#output-path-issues","title":"Output / path issues","text":""},{"location":"troubleshooting.html#files-going-to-wrong-directory","title":"Files going to wrong directory","text":"Cause: output_dir setting or CWD mismatch.
Check:
# Verify your config\ngrep output_dir config.yaml\n\n# Check where you're running from\npwd\n\n# Use absolute paths to avoid ambiguity\nlibrofm-downloader --config /absolute/path/to/config.yaml\n"},{"location":"troubleshooting.html#permission-denied-when-writing-files","title":"\"Permission denied\" when writing files","text":"Cause: The user running the tool doesn't have write access to output_dir.
Fix:
# Check permissions\nls -la ./audiobooks/\n\n# Fix ownership or choose a writable directory\nchmod u+w ./audiobooks/\n# or set output_dir to somewhere writable in config.yaml\n"},{"location":"troubleshooting.html#performance","title":"Performance","text":""},{"location":"troubleshooting.html#downloads-are-slow","title":"Downloads are slow","text":"Check:
The tool downloads in a single stream per book (no parallelism within one book), but can process multiple books in parallel via --workers N (default 3). Libro.fm API calls are rate-limited to 3 concurrent requests regardless of worker count.
Audiobooks are large (200 MB \u2013 1 GB each). A library of 50 books at 2 MB/s would take ~7 hours just for transfer time. This is expected behavior.
Use --limit to process smaller batches:
# Download 5 books at a time\nlibrofm-downloader --limit 5\n"},{"location":"troubleshooting.html#getting-help","title":"Getting help","text":"If none of the above covers your issue:
-v (--verbose) to get detailed output including URLs and tracebacks-v output)format settingpython --version)