- Rust 90%
- HTML 9.6%
- Dockerfile 0.2%
- Python 0.2%
| book-auto-downloader | ||
| kobo-rust | ||
| libation-rust | ||
| librofm-rust | ||
| .dockerignore | ||
| .gitignore | ||
| Cargo.lock | ||
| Cargo.toml | ||
| CLAUDE.md | ||
| Dockerfile | ||
| example-config.json | ||
| example-daemon.toml | ||
| example.env | ||
| m4b-chapters.py | ||
| README.md | ||
Book Auto-Downloader
A Rust workspace for automatically downloading and DRM-removing books from Kobo, Audible, and Libro.fm.
AI Disclaimer
This project used AI tools to port & generate the initial codebase & documentation. Future work may involve less AI as I get more comfortable returning to the old ways.
Workspace Structure
| Crate | Description |
|---|---|
book-auto-downloader |
Main daemon and CLI tool |
kobo-rust |
Kobo API client library |
libation-rust |
Audible API client library (port of Libation) |
librofm-rust |
Libro.fm audiobook API client library |
Features
- Kobo: Authenticate, list, and download eBooks with automatic KDRM removal
- Audible: OAuth authentication and library listing (download/DRM support in progress)
- Libro.fm: Password authentication, library listing, and audiobook downloads (MP3 or M4B)
- Daemon: Runs continuously, checking for new Kobo books on a configurable schedule
- Web UI: Browser-based account management, OAuth flows, and manual download triggers
- BookLore Integration: Optionally upload books to a BookLore instance
- SQLite: All credentials and download state stored in a local database
- Docker: Containerized deployment with volume mounts for config and downloads
- Libation Import: Import existing Audible credentials from a Libation config
Quick Start
Local Build
cargo build --release -p book-auto-downloader
# Authenticate a Kobo account
./target/release/book-auto-downloader auth your-email@example.com
# Run a one-time sync
./target/release/book-auto-downloader sync
# Run the daemon continuously
./target/release/book-auto-downloader daemon
Docker
# Build the image
docker build -t book-auto-downloader .
# Create config directory with correct permissions (container runs as UID 1000)
mkdir -p ./config
sudo chown -R 1000:1000 ./config
# Authenticate your Kobo account
docker run -it -v ./config:/config book-auto-downloader auth your-email@example.com
# Run the daemon
mkdir -p ./downloads
docker run -d \
--name book-downloader \
-v ./config:/config \
-v ./downloads:/downloads \
--restart unless-stopped \
book-auto-downloader daemon
CLI Reference
book-auto-downloader [COMMAND]
| Command | Description |
|---|---|
daemon (default) |
Run the daemon continuously |
sync |
Perform a one-time sync and exit |
status |
Show daemon status and download statistics |
config |
Show current configuration |
auth <email> |
Authenticate a Kobo account interactively |
auth-audible <email> |
Authenticate an Audible account (web UI recommended) |
auth-librofm <email> |
Authenticate a Libro.fm account interactively |
import-libation <file> |
Import accounts from a Libation config.json |
import-csv <file> |
Import a CSV of books to mark as already downloaded |
list-tracked |
List all tracked books for an account |
remove-tracked <title> |
Remove books from the tracker by title search |
backfill-metadata |
Fill in missing metadata from the Kobo library |
booklore-check |
Report which Kobo books are missing from BookLore |
Configuration
Configuration is loaded from daemon.toml. Copy the example and edit:
cp example-daemon.toml ~/.config/book-auto-downloader/daemon.toml
In Docker, the config file lives at /config/.config/book-auto-downloader/daemon.toml (or the simplified /config/daemon.toml path when built with the docker feature).
Key Settings
check_interval = "1h" # How often to check for new books
download_path = "./book_downloads"
max_concurrent_downloads = 3
log_level = "info"
[booklore]
enabled = false
url = ""
username = ""
password = ""
skip_existing = true
upload_enabled = true
upload_mode = "bookdrop" # "bookdrop" or "direct"
[web]
enabled = true
port = 8080
bind_address = "0.0.0.0"
Environment Variables
All settings can be overridden with BOOKDL_ prefixed environment variables:
| Variable | Description |
|---|---|
BOOKDL_ACCOUNTS |
Comma-separated email list (initial accounts) |
BOOKDL_CHECK_INTERVAL |
e.g. "1h", "30m", "2h30m" |
BOOKDL_EBOOKS_PATH |
Ebooks directory (default: ./books) |
BOOKDL_AUDIOBOOKS_PATH |
Audiobooks directory (default: ./audiobooks) |
BOOKDL_MAX_CONCURRENT_DOWNLOADS |
Default: 3 |
BOOKDL_LOG_LEVEL |
trace, debug, info, warn, error |
BOOKDL_BOOKLORE_ENABLED |
"true" or "false" |
BOOKDL_BOOKLORE_URL |
e.g. "http://host.docker.internal:8080" |
BOOKDL_BOOKLORE_USERNAME |
BookLore username |
BOOKDL_BOOKLORE_PASSWORD |
BookLore password |
BOOKDL_BOOKLORE_SKIP_EXISTING |
Skip books already in BookLore |
BOOKDL_BOOKLORE_UPLOAD_ENABLED |
Upload books after download |
BOOKDL_BOOKLORE_DELETE_AFTER_UPLOAD |
Delete local EPUB after upload |
BOOKDL_BOOKLORE_UPLOAD_MODE |
"bookdrop" or "direct" |
BOOKDL_BOOKLORE_LIBRARY_ID |
Library ID for direct mode |
BOOKDL_BOOKLORE_PATH_ID |
Path ID for direct mode |
Authentication
Kobo
book-auto-downloader auth your-email@example.com
This opens a browser-based activation flow at kobo.com/activate. Credentials are saved to the local SQLite database.
Audible
Audible uses OAuth 2.0 with PKCE. The web UI provides the full flow:
- Start the daemon with the web UI enabled (default)
- Visit
http://localhost:8080/auth/audible - Complete the Amazon login in your browser
- Credentials are saved automatically
Alternatively, import credentials from an existing Libation installation:
book-auto-downloader import-libation /path/to/libation/config.json
Libro.fm
Libro.fm uses a simple email/password login. Either use the CLI:
book-auto-downloader auth-librofm your-email@example.com
Or via the web UI at http://localhost:8080/auth/librofm.
Web UI
When running with web.enabled = true (the default), the daemon exposes a web interface at http://localhost:8080 for:
- Viewing configured accounts and download status
- Adding Kobo accounts (web-based activation flow)
- Adding Audible accounts (full OAuth flow)
- Adding Libro.fm accounts (email/password login)
- Browsing Audible and Libro.fm libraries and triggering manual downloads
- Managing accounts without restarting the daemon
Docker: docker-compose
Copy example.env to .env and customize, then:
# docker-compose.yml
services:
book-downloader:
image: book-auto-downloader
container_name: book-downloader
volumes:
- ./config:/config
- ./downloads:/downloads
env_file:
- .env
ports:
- "8080:8080" # Web UI
restart: unless-stopped
docker-compose up -d
Useful Docker Commands
# View logs
docker logs -f book-downloader
# One-time sync
docker run --rm -v ./config:/config -v ./downloads:/downloads book-auto-downloader sync
# Check status
docker exec book-downloader book-auto-downloader status
Volume Mounts
| Mount | Purpose |
|---|---|
/config |
Persistent config and SQLite database |
/downloads |
Downloaded books |
Permission Note
The container runs as UID 1000. If you encounter Permission denied errors:
sudo chown -R 1000:1000 ./config
Credential Storage
All credentials (Kobo tokens, Audible OAuth tokens, Libro.fm access tokens) and download state are stored in a SQLite database at:
- Local:
~/.local/share/book-auto-downloader/books.db(platform default) - Docker:
/config/.local/share/book-auto-downloader/books.db
Supported Formats
- Kobo eBooks: EPUB with KDRM removal
- Kobo Audiobooks: Multi-file download to subdirectory
- Audible: Library listing complete; download and DRM removal planned
- Libro.fm: MP3 (ZIP-extracted tracks) and M4B (single file)
Development
# Build all crates
cargo build
# Run tests
cargo test
# Check without building
cargo check
# Format
cargo fmt
# Lint
cargo clippy
Requirements
- Rust 1.70+
- Kobo account with email login
- Audible/Amazon account (for Audible features)
- Libro.fm account (for Libro.fm features)
- Internet connection
Limitations
- Adobe DRM not supported (Kobo KDRM only)
- Audible download and DRM removal not yet implemented
- Audible auth requires the web UI for the full OAuth flow
- Libro.fm downloads are triggered manually via the web UI; no daemon auto-sync
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Ensure
cargo testpasses - Submit a pull request
License
MIT OR Apache-2.0
Acknowledgments
- kobo-book-downloader — original Python Kobo client by Brandon Davis
- Libation — C# Audible manager that
libation-rustis ported from - librofm-downloader — Kotlin Libro.fm downloader that
librofm-rustis based on
Disclaimer
This tool is for personal use only. Please respect the Terms of Service of Kobo, Audible, and Libro.fm, and only download books you have legally purchased.