bookbot-cli 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bookbot_cli-0.3.0/LICENSE +21 -0
- bookbot_cli-0.3.0/PKG-INFO +307 -0
- bookbot_cli-0.3.0/README.md +254 -0
- bookbot_cli-0.3.0/bookbot/__init__.py +12 -0
- bookbot_cli-0.3.0/bookbot/cli.py +1373 -0
- bookbot_cli-0.3.0/bookbot/config/__init__.py +1 -0
- bookbot_cli-0.3.0/bookbot/config/manager.py +230 -0
- bookbot_cli-0.3.0/bookbot/config/models.py +232 -0
- bookbot_cli-0.3.0/bookbot/convert/__init__.py +1 -0
- bookbot_cli-0.3.0/bookbot/convert/ffmpeg.py +386 -0
- bookbot_cli-0.3.0/bookbot/convert/pipeline.py +379 -0
- bookbot_cli-0.3.0/bookbot/core/__init__.py +1 -0
- bookbot_cli-0.3.0/bookbot/core/discovery.py +417 -0
- bookbot_cli-0.3.0/bookbot/core/exceptions.py +48 -0
- bookbot_cli-0.3.0/bookbot/core/logging.py +81 -0
- bookbot_cli-0.3.0/bookbot/core/matching.py +210 -0
- bookbot_cli-0.3.0/bookbot/core/models.py +313 -0
- bookbot_cli-0.3.0/bookbot/core/operations.py +386 -0
- bookbot_cli-0.3.0/bookbot/core/templates.py +333 -0
- bookbot_cli-0.3.0/bookbot/drm/__init__.py +8 -0
- bookbot_cli-0.3.0/bookbot/drm/activator.py +98 -0
- bookbot_cli-0.3.0/bookbot/drm/audible_browser_auth.py +428 -0
- bookbot_cli-0.3.0/bookbot/drm/audible_client.py +232 -0
- bookbot_cli-0.3.0/bookbot/drm/detector.py +166 -0
- bookbot_cli-0.3.0/bookbot/drm/models.py +62 -0
- bookbot_cli-0.3.0/bookbot/drm/py.typed +0 -0
- bookbot_cli-0.3.0/bookbot/drm/remover.py +294 -0
- bookbot_cli-0.3.0/bookbot/drm/secure_storage.py +127 -0
- bookbot_cli-0.3.0/bookbot/gui.py +28 -0
- bookbot_cli-0.3.0/bookbot/io/__init__.py +1 -0
- bookbot_cli-0.3.0/bookbot/io/cache.py +217 -0
- bookbot_cli-0.3.0/bookbot/providers/__init__.py +19 -0
- bookbot_cli-0.3.0/bookbot/providers/audible.py +465 -0
- bookbot_cli-0.3.0/bookbot/providers/base.py +123 -0
- bookbot_cli-0.3.0/bookbot/providers/googlebooks.py +340 -0
- bookbot_cli-0.3.0/bookbot/providers/health.py +100 -0
- bookbot_cli-0.3.0/bookbot/providers/librivox.py +286 -0
- bookbot_cli-0.3.0/bookbot/providers/local.py +295 -0
- bookbot_cli-0.3.0/bookbot/providers/manager.py +123 -0
- bookbot_cli-0.3.0/bookbot/providers/openlibrary.py +541 -0
- bookbot_cli-0.3.0/bookbot/tests/__init__.py +1 -0
- bookbot_cli-0.3.0/bookbot/tui/__init__.py +1 -0
- bookbot_cli-0.3.0/bookbot/tui/app.py +563 -0
- bookbot_cli-0.3.0/bookbot/tui/screens.py +581 -0
- bookbot_cli-0.3.0/bookbot_cli.egg-info/PKG-INFO +307 -0
- bookbot_cli-0.3.0/bookbot_cli.egg-info/SOURCES.txt +53 -0
- bookbot_cli-0.3.0/bookbot_cli.egg-info/dependency_links.txt +1 -0
- bookbot_cli-0.3.0/bookbot_cli.egg-info/entry_points.txt +4 -0
- bookbot_cli-0.3.0/bookbot_cli.egg-info/requires.txt +32 -0
- bookbot_cli-0.3.0/bookbot_cli.egg-info/top_level.txt +1 -0
- bookbot_cli-0.3.0/pyproject.toml +119 -0
- bookbot_cli-0.3.0/setup.cfg +4 -0
- bookbot_cli-0.3.0/tests/test_discovery.py +169 -0
- bookbot_cli-0.3.0/tests/test_local_provider.py +88 -0
- bookbot_cli-0.3.0/tests/test_templates.py +282 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 BookBot
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bookbot-cli
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: A cross-platform TUI audiobook renamer and organizer
|
|
5
|
+
Author-email: itsbryanman <itsbryanman@users.noreply.github.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/itsbryanman/BookBot
|
|
8
|
+
Project-URL: Repository, https://github.com/itsbryanman/BookBot
|
|
9
|
+
Project-URL: Issues, https://github.com/itsbryanman/BookBot/issues
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Topic :: Multimedia :: Sound/Audio
|
|
19
|
+
Classifier: Topic :: Utilities
|
|
20
|
+
Requires-Python: >=3.10
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: textual>=0.41.0
|
|
24
|
+
Requires-Dist: mutagen>=1.47.0
|
|
25
|
+
Requires-Dist: requests>=2.31.0
|
|
26
|
+
Requires-Dist: click>=8.1.0
|
|
27
|
+
Requires-Dist: pydantic>=2.4.0
|
|
28
|
+
Requires-Dist: toml>=0.10.2
|
|
29
|
+
Requires-Dist: rich>=13.0.0
|
|
30
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
31
|
+
Requires-Dist: rapidfuzz>=3.0.0
|
|
32
|
+
Requires-Dist: aiofiles>=23.0.0
|
|
33
|
+
Requires-Dist: aiohttp>=3.8.0
|
|
34
|
+
Requires-Dist: keyring>=24.0.0
|
|
35
|
+
Requires-Dist: beautifulsoup4>=4.12.0
|
|
36
|
+
Requires-Dist: cryptography>=41.0.0
|
|
37
|
+
Requires-Dist: playwright>=1.40.0
|
|
38
|
+
Provides-Extra: dev
|
|
39
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
40
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
42
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
43
|
+
Requires-Dist: mypy>=1.5.0; extra == "dev"
|
|
44
|
+
Requires-Dist: ruff>=0.0.290; extra == "dev"
|
|
45
|
+
Requires-Dist: textual-dev>=1.2.0; extra == "dev"
|
|
46
|
+
Provides-Extra: conversion
|
|
47
|
+
Requires-Dist: ffmpeg-python>=0.2.0; extra == "conversion"
|
|
48
|
+
Provides-Extra: build
|
|
49
|
+
Requires-Dist: build>=0.10.0; extra == "build"
|
|
50
|
+
Requires-Dist: twine>=4.0.0; extra == "build"
|
|
51
|
+
Requires-Dist: pyinstaller>=5.0.0; extra == "build"
|
|
52
|
+
Dynamic: license-file
|
|
53
|
+
|
|
54
|
+
<p align="center">
|
|
55
|
+
<img src="logo.png" alt="BookBot logo" width="220" />
|
|
56
|
+
</p>
|
|
57
|
+
|
|
58
|
+
<h1 align="center">BookBot</h1>
|
|
59
|
+
|
|
60
|
+
<p align="center"><em>Declarative audiobook command center for collectors who care about clean metadata.</em></p>
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<a href="https://github.com/itsbryanman/BookBot/actions/workflows/ci.yml">
|
|
64
|
+
<img alt="CI" src="https://github.com/itsbryanman/BookBot/actions/workflows/ci.yml/badge.svg?style=for-the-badge" />
|
|
65
|
+
</a>
|
|
66
|
+
<a href="https://ghcr.io/itsbryanman/bookbot">
|
|
67
|
+
<img alt="Docker" src="https://img.shields.io/badge/docker-ghcr.io%2Fitsbryanman%2Fbookbot-2496ED?style=for-the-badge&logo=docker&logoColor=white" />
|
|
68
|
+
</a>
|
|
69
|
+
<a href="https://pypi.org/project/bookbot/">
|
|
70
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/bookbot?style=for-the-badge&logo=pypi&logoColor=white" />
|
|
71
|
+
</a>
|
|
72
|
+
<a href="https://pypi.org/project/bookbot/">
|
|
73
|
+
<img alt="Python versions" src="https://img.shields.io/pypi/pyversions/bookbot?style=for-the-badge&logo=python&logoColor=white" />
|
|
74
|
+
</a>
|
|
75
|
+
<a href="LICENSE">
|
|
76
|
+
<img alt="License" src="https://img.shields.io/github/license/itsbryanman/BookBot?style=for-the-badge&color=brightgreen" />
|
|
77
|
+
</a>
|
|
78
|
+
<a href="https://github.com/psf/black">
|
|
79
|
+
<img alt="Code style" src="https://img.shields.io/badge/code%20style-black-000000?style=for-the-badge&logo=python&logoColor=white" />
|
|
80
|
+
</a>
|
|
81
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
82
|
+
<img alt="Ruff" src="https://img.shields.io/badge/linter-ruff-FCC21B?style=for-the-badge&logo=ruff&logoColor=white" />
|
|
83
|
+
</a>
|
|
84
|
+
<a href="http://mypy-lang.org/">
|
|
85
|
+
<img alt="Typing" src="https://img.shields.io/badge/typed-mypy-blue?style=for-the-badge&logo=python&logoColor=white" />
|
|
86
|
+
</a>
|
|
87
|
+
</p>
|
|
88
|
+
|
|
89
|
+
BookBot is a Textual powered terminal app and command line toolkit for taming large audiobook libraries. It discovers tracks, reconciles metadata across multiple providers, proposes safe rename plans, and can optionally retag, convert, and de-DRM your collection end to end.
|
|
90
|
+
|
|
91
|
+
## Highlights
|
|
92
|
+
|
|
93
|
+
- Safety first workflow with dry-runs, atomic file operations, transaction history, and undo support.
|
|
94
|
+
- Fast metadata discovery that combines local heuristics with Open Library plus optional Google Books, LibriVox, and Audible lookups.
|
|
95
|
+
- Modern TUI for interactive review plus full CLI coverage for scripting and automation.
|
|
96
|
+
- Configurable templates and profiles so folders, file names, covers, and tags match the way your players expect them.
|
|
97
|
+
- Optional M4B conversion pipeline with FFmpeg stream copy, loudness normalization, and chapter generation.
|
|
98
|
+
- Audible authentication, DRM detection, and removal helpers for supported formats (AAX, AAXC, M4B, and more).
|
|
99
|
+
|
|
100
|
+
## Installation
|
|
101
|
+
|
|
102
|
+
Docker is the fastest way to run BookBot with every dependency pre-baked. It keeps FFmpeg, optional DRM tooling, and Python libraries in one container so your host stays clean.
|
|
103
|
+
|
|
104
|
+
### Docker (recommended)
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
docker run -it --rm \
|
|
108
|
+
-v "/path/to/audiobooks:/data" \
|
|
109
|
+
-v "$HOME/.config/bookbot:/root/.config/bookbot" \
|
|
110
|
+
ghcr.io/itsbryanman/bookbot:latest tui /data
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Mount your library into `/data` (or any path you prefer) and persist configuration under `~/.config/bookbot`. Swap `tui /data` for other commands like `scan /data` or `convert /book --profile conversion`.
|
|
114
|
+
|
|
115
|
+
You can also add a convenience alias:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
alias bookbot-docker='docker run -it --rm -v "$HOME/.config/bookbot:/root/.config/bookbot" -v "$PWD:/data" ghcr.io/itsbryanman/bookbot:latest'
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Then run `bookbot-docker tui /data` from any library directory.
|
|
122
|
+
|
|
123
|
+
### pipx (alternative)
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
pipx install bookbot
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
pipx keeps BookBot isolated and ensures the `bookbot` command lands on your PATH. If the executable is not found after install, add `$HOME/.local/bin` to your shell profile.
|
|
130
|
+
|
|
131
|
+
### pip / virtualenv (alternative)
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
python -m pip install bookbot
|
|
135
|
+
python -m pip install "bookbot[conversion]"
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
You still need a system FFmpeg binary for audio conversion and DRM extraction.
|
|
139
|
+
|
|
140
|
+
### From source
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
git clone https://github.com/itsbryanman/BookBot.git
|
|
144
|
+
cd BookBot
|
|
145
|
+
python -m pip install -e .[dev]
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
The editable install gives you live reload while iterating on the app.
|
|
149
|
+
|
|
150
|
+
## Quick start
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# 1. Inspect a library without touching files
|
|
154
|
+
bookbot scan /path/to/audiobooks
|
|
155
|
+
|
|
156
|
+
# 2. Launch the Textual TUI to review matches and approve changes
|
|
157
|
+
bookbot tui /path/to/audiobooks
|
|
158
|
+
|
|
159
|
+
# Stay offline by reusing existing sidecar metadata
|
|
160
|
+
bookbot tui /path/to/audiobooks --metadata-from-files
|
|
161
|
+
|
|
162
|
+
# 3. Convert a finished book to a single tagged M4B
|
|
163
|
+
bookbot convert /path/to/book -o /path/to/output --normalize --chapters auto
|
|
164
|
+
|
|
165
|
+
# 4. Authenticate with Audible once, then import books by ASIN
|
|
166
|
+
bookbot audible auth
|
|
167
|
+
bookbot audible import B01234567X --remove-drm
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Prefer a desktop entry point? `bookbot gui` launches the same Textual application and falls back to the CLI if GUI dependencies are missing.
|
|
171
|
+
|
|
172
|
+
## Core workflows
|
|
173
|
+
|
|
174
|
+
**Organize safely**
|
|
175
|
+
- Every scan is a dry-run. Use the TUI preview to inspect proposed renames, covers, tags, and conversions.
|
|
176
|
+
- Confirmed changes are recorded as transactions so you can `bookbot history` and `bookbot undo <id>` at any time.
|
|
177
|
+
|
|
178
|
+
**Tailor metadata**
|
|
179
|
+
- Activate opinionated profiles (`safe`, `full`, `plex`, `conversion`) with `bookbot config list` and `bookbot config show plex`.
|
|
180
|
+
- Customize naming templates in `~/.config/bookbot/templates` or swap templates at runtime with `--template` flags.
|
|
181
|
+
|
|
182
|
+
**Bring your own providers**
|
|
183
|
+
- Open Library is always on. Add Google Books, LibriVox, or Audible enrichment with:
|
|
184
|
+
```bash
|
|
185
|
+
bookbot provider set-key googlebooks YOUR_API_KEY
|
|
186
|
+
bookbot provider enable librivox
|
|
187
|
+
bookbot provider enable audible
|
|
188
|
+
bookbot provider list
|
|
189
|
+
```
|
|
190
|
+
- Audible marketplace defaults to US; switch with `bookbot provider set-marketplace UK`.
|
|
191
|
+
|
|
192
|
+
**Convert and normalize**
|
|
193
|
+
- Install FFmpeg, then enable the conversion profile or pass `--profile conversion`.
|
|
194
|
+
- Stream copy AAC sources when possible, or set bitrate/VBR/normalization flags per run.
|
|
195
|
+
- Chapters can come from tags, track order, or custom names depending on your config.
|
|
196
|
+
|
|
197
|
+
**DRM tooling**
|
|
198
|
+
- Detect protection on folders of files with `bookbot drm detect ./library --recursive`.
|
|
199
|
+
- Store activation bytes once using `bookbot drm set-activation-bytes DEADBEAF`.
|
|
200
|
+
- Remove DRM in place or to a clean output location using `bookbot drm remove book.aax -o ./clean`.
|
|
201
|
+
|
|
202
|
+
## CLI cheat sheet
|
|
203
|
+
|
|
204
|
+
| Command | Purpose |
|
|
205
|
+
| --- | --- |
|
|
206
|
+
| `bookbot scan DIR` | Inspect directories, infer series/disc structure, and surface warnings without touching files. |
|
|
207
|
+
| `bookbot tui DIR...` | Launch the interactive Textual interface to match metadata, approve rename plans, and start conversions. Add `--metadata-from-files` to reuse local NFO/JSON sidecars instead of online providers. |
|
|
208
|
+
| `bookbot convert DIR -o OUT` | Build single-file, chaptered M4B releases with optional normalization and artwork. |
|
|
209
|
+
| `bookbot history --days 7` | Review completed transactions and identify undo candidates. |
|
|
210
|
+
| `bookbot undo ID` | Roll back an operation safely using its transaction identifier. |
|
|
211
|
+
| `bookbot provider ...` | Enable, disable, and configure metadata providers and API keys. |
|
|
212
|
+
| `bookbot config ...` | Manage global config, reset defaults, and inspect profile settings stored under `~/.config/bookbot`. |
|
|
213
|
+
| `bookbot audible ...` | Authenticate, list your library, and download titles directly from Audible. |
|
|
214
|
+
| `bookbot drm ...` | Detect DRM, save activation bytes, and convert protected files. |
|
|
215
|
+
| `bookbot completions SHELL` | Generate shell completions (bash, zsh, fish, or all). |
|
|
216
|
+
|
|
217
|
+
Use `--help` on any command or subgroup for the full option set.
|
|
218
|
+
|
|
219
|
+
## Configuration directory layout
|
|
220
|
+
|
|
221
|
+
| Location | Purpose |
|
|
222
|
+
| --- | --- |
|
|
223
|
+
| `~/.config/bookbot/config.toml` | Primary configuration file persisted by the TUI and CLI. |
|
|
224
|
+
| `~/.config/bookbot/profiles/*.toml` | Saved profiles, including the bundled `safe`, `full`, `plex`, and `conversion` presets. |
|
|
225
|
+
| `~/.cache/bookbot/` | Cached metadata, cover art, and conversion plans. Delete to force fresh lookups. |
|
|
226
|
+
| `~/.local/share/bookbot/transactions.json` | Transaction history used for undo and audit logs. |
|
|
227
|
+
|
|
228
|
+
Config files use TOML; edit by hand or via `bookbot config` commands.
|
|
229
|
+
|
|
230
|
+
## Metadata providers
|
|
231
|
+
|
|
232
|
+
| Provider | Notes |
|
|
233
|
+
| --- | --- |
|
|
234
|
+
| Open Library | Default, always enabled, free. Core search source for titles and authors. |
|
|
235
|
+
| Google Books | Requires an API key; adds richer descriptions and ISBN data. |
|
|
236
|
+
| LibriVox | Public domain library; great for narrator and language hints. |
|
|
237
|
+
| Audible | Requires authentication; unlocks commercial metadata and download tooling. |
|
|
238
|
+
|
|
239
|
+
Provider priorities and fallback logic are configurable through the `ConfigManager`. Combine multiple providers for higher confidence matches.
|
|
240
|
+
|
|
241
|
+
## Conversion pipeline
|
|
242
|
+
|
|
243
|
+
The conversion subsystem lives in `bookbot.convert` and wraps FFmpeg (through `ffmpeg-python`) to build high quality, chaptered M4B files. Highlights:
|
|
244
|
+
|
|
245
|
+
- Auto-detects when stream copy is safe to avoid re-encoding AAC tracks.
|
|
246
|
+
- Supports bitrate or VBR quality targets with optional EBU R128 loudness normalization.
|
|
247
|
+
- Generates chapter markers from track segmentation or existing tags.
|
|
248
|
+
- Embeds cover art and metadata pulled from the selected provider record.
|
|
249
|
+
- Writes conversion plans to disk so you can dry-run before touching anything (`bookbot convert --dry-run`).
|
|
250
|
+
|
|
251
|
+
## DRM and Audible helpers
|
|
252
|
+
|
|
253
|
+
BookBot includes a focused DRM toolkit backed by `ffmpeg` and the `audible` Python package.
|
|
254
|
+
|
|
255
|
+
1. Authenticate once with `bookbot audible auth`; credentials are stored securely via `keyring`.
|
|
256
|
+
2. List your library (`bookbot audible list --limit 50`) or import specific titles by ASIN.
|
|
257
|
+
3. Use `bookbot drm detect` to map protected files and `bookbot drm remove` to produce DRM-free audio. Activation bytes can be supplied per run or cached via `bookbot drm set-activation-bytes`.
|
|
258
|
+
|
|
259
|
+
### Retrieving Activation Bytes
|
|
260
|
+
|
|
261
|
+
For DRM removal of Audible files, you'll need your account's activation bytes. BookBot can retrieve these for you.
|
|
262
|
+
|
|
263
|
+
**Dependencies:**
|
|
264
|
+
|
|
265
|
+
This feature requires `selenium` and `chromedriver`. If you are not using the Docker image, you will need to install them:
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
pip install selenium
|
|
269
|
+
# Make sure chromedriver is in your PATH
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Usage:**
|
|
273
|
+
|
|
274
|
+
Run the following command and follow the prompts to enter your Audible username and password:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
bookbot audible get-activation-bytes
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
This will securely save your activation bytes for future use. After this one-time setup, you can remove DRM from your books without needing to provide the activation bytes every time.
|
|
281
|
+
|
|
282
|
+
These features depend on optional packages (`audible`, `cryptography`, `keyring`, `selenium`) that are already declared in `pyproject.toml`. Ensure FFmpeg is compiled with the modules required for Audible AAX/AAXC processing.
|
|
283
|
+
|
|
284
|
+
## Development
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
make install-dev # install dev dependencies
|
|
288
|
+
make lint # ruff + mypy
|
|
289
|
+
make format # black
|
|
290
|
+
make test # pytest
|
|
291
|
+
make pre-commit # run the full formatting and lint bundle
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
Textual ships with a live reload server: run `textual run --dev bookbot.tui.app:BookBotApp` while editing the TUI.
|
|
295
|
+
|
|
296
|
+
## Contributing
|
|
297
|
+
|
|
298
|
+
We welcome issues and pull requests. Please:
|
|
299
|
+
|
|
300
|
+
1. Fork the repo and create a feature branch.
|
|
301
|
+
2. Add or update tests under `tests/` for any new functionality.
|
|
302
|
+
3. Run `make pre-commit` before submitting to keep style and typing checks green.
|
|
303
|
+
4. Document user-facing changes in this README or the changelog if applicable.
|
|
304
|
+
|
|
305
|
+
## License
|
|
306
|
+
|
|
307
|
+
BookBot is released under the MIT License. See [LICENSE](LICENSE) for the full text.
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="logo.png" alt="BookBot logo" width="220" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">BookBot</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center"><em>Declarative audiobook command center for collectors who care about clean metadata.</em></p>
|
|
8
|
+
|
|
9
|
+
<p align="center">
|
|
10
|
+
<a href="https://github.com/itsbryanman/BookBot/actions/workflows/ci.yml">
|
|
11
|
+
<img alt="CI" src="https://github.com/itsbryanman/BookBot/actions/workflows/ci.yml/badge.svg?style=for-the-badge" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://ghcr.io/itsbryanman/bookbot">
|
|
14
|
+
<img alt="Docker" src="https://img.shields.io/badge/docker-ghcr.io%2Fitsbryanman%2Fbookbot-2496ED?style=for-the-badge&logo=docker&logoColor=white" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://pypi.org/project/bookbot/">
|
|
17
|
+
<img alt="PyPI" src="https://img.shields.io/pypi/v/bookbot?style=for-the-badge&logo=pypi&logoColor=white" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://pypi.org/project/bookbot/">
|
|
20
|
+
<img alt="Python versions" src="https://img.shields.io/pypi/pyversions/bookbot?style=for-the-badge&logo=python&logoColor=white" />
|
|
21
|
+
</a>
|
|
22
|
+
<a href="LICENSE">
|
|
23
|
+
<img alt="License" src="https://img.shields.io/github/license/itsbryanman/BookBot?style=for-the-badge&color=brightgreen" />
|
|
24
|
+
</a>
|
|
25
|
+
<a href="https://github.com/psf/black">
|
|
26
|
+
<img alt="Code style" src="https://img.shields.io/badge/code%20style-black-000000?style=for-the-badge&logo=python&logoColor=white" />
|
|
27
|
+
</a>
|
|
28
|
+
<a href="https://github.com/astral-sh/ruff">
|
|
29
|
+
<img alt="Ruff" src="https://img.shields.io/badge/linter-ruff-FCC21B?style=for-the-badge&logo=ruff&logoColor=white" />
|
|
30
|
+
</a>
|
|
31
|
+
<a href="http://mypy-lang.org/">
|
|
32
|
+
<img alt="Typing" src="https://img.shields.io/badge/typed-mypy-blue?style=for-the-badge&logo=python&logoColor=white" />
|
|
33
|
+
</a>
|
|
34
|
+
</p>
|
|
35
|
+
|
|
36
|
+
BookBot is a Textual powered terminal app and command line toolkit for taming large audiobook libraries. It discovers tracks, reconciles metadata across multiple providers, proposes safe rename plans, and can optionally retag, convert, and de-DRM your collection end to end.
|
|
37
|
+
|
|
38
|
+
## Highlights
|
|
39
|
+
|
|
40
|
+
- Safety first workflow with dry-runs, atomic file operations, transaction history, and undo support.
|
|
41
|
+
- Fast metadata discovery that combines local heuristics with Open Library plus optional Google Books, LibriVox, and Audible lookups.
|
|
42
|
+
- Modern TUI for interactive review plus full CLI coverage for scripting and automation.
|
|
43
|
+
- Configurable templates and profiles so folders, file names, covers, and tags match the way your players expect them.
|
|
44
|
+
- Optional M4B conversion pipeline with FFmpeg stream copy, loudness normalization, and chapter generation.
|
|
45
|
+
- Audible authentication, DRM detection, and removal helpers for supported formats (AAX, AAXC, M4B, and more).
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
Docker is the fastest way to run BookBot with every dependency pre-baked. It keeps FFmpeg, optional DRM tooling, and Python libraries in one container so your host stays clean.
|
|
50
|
+
|
|
51
|
+
### Docker (recommended)
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
docker run -it --rm \
|
|
55
|
+
-v "/path/to/audiobooks:/data" \
|
|
56
|
+
-v "$HOME/.config/bookbot:/root/.config/bookbot" \
|
|
57
|
+
ghcr.io/itsbryanman/bookbot:latest tui /data
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Mount your library into `/data` (or any path you prefer) and persist configuration under `~/.config/bookbot`. Swap `tui /data` for other commands like `scan /data` or `convert /book --profile conversion`.
|
|
61
|
+
|
|
62
|
+
You can also add a convenience alias:
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
alias bookbot-docker='docker run -it --rm -v "$HOME/.config/bookbot:/root/.config/bookbot" -v "$PWD:/data" ghcr.io/itsbryanman/bookbot:latest'
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Then run `bookbot-docker tui /data` from any library directory.
|
|
69
|
+
|
|
70
|
+
### pipx (alternative)
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pipx install bookbot
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
pipx keeps BookBot isolated and ensures the `bookbot` command lands on your PATH. If the executable is not found after install, add `$HOME/.local/bin` to your shell profile.
|
|
77
|
+
|
|
78
|
+
### pip / virtualenv (alternative)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
python -m pip install bookbot
|
|
82
|
+
python -m pip install "bookbot[conversion]"
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
You still need a system FFmpeg binary for audio conversion and DRM extraction.
|
|
86
|
+
|
|
87
|
+
### From source
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/itsbryanman/BookBot.git
|
|
91
|
+
cd BookBot
|
|
92
|
+
python -m pip install -e .[dev]
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The editable install gives you live reload while iterating on the app.
|
|
96
|
+
|
|
97
|
+
## Quick start
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# 1. Inspect a library without touching files
|
|
101
|
+
bookbot scan /path/to/audiobooks
|
|
102
|
+
|
|
103
|
+
# 2. Launch the Textual TUI to review matches and approve changes
|
|
104
|
+
bookbot tui /path/to/audiobooks
|
|
105
|
+
|
|
106
|
+
# Stay offline by reusing existing sidecar metadata
|
|
107
|
+
bookbot tui /path/to/audiobooks --metadata-from-files
|
|
108
|
+
|
|
109
|
+
# 3. Convert a finished book to a single tagged M4B
|
|
110
|
+
bookbot convert /path/to/book -o /path/to/output --normalize --chapters auto
|
|
111
|
+
|
|
112
|
+
# 4. Authenticate with Audible once, then import books by ASIN
|
|
113
|
+
bookbot audible auth
|
|
114
|
+
bookbot audible import B01234567X --remove-drm
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
Prefer a desktop entry point? `bookbot gui` launches the same Textual application and falls back to the CLI if GUI dependencies are missing.
|
|
118
|
+
|
|
119
|
+
## Core workflows
|
|
120
|
+
|
|
121
|
+
**Organize safely**
|
|
122
|
+
- Every scan is a dry-run. Use the TUI preview to inspect proposed renames, covers, tags, and conversions.
|
|
123
|
+
- Confirmed changes are recorded as transactions so you can `bookbot history` and `bookbot undo <id>` at any time.
|
|
124
|
+
|
|
125
|
+
**Tailor metadata**
|
|
126
|
+
- Activate opinionated profiles (`safe`, `full`, `plex`, `conversion`) with `bookbot config list` and `bookbot config show plex`.
|
|
127
|
+
- Customize naming templates in `~/.config/bookbot/templates` or swap templates at runtime with `--template` flags.
|
|
128
|
+
|
|
129
|
+
**Bring your own providers**
|
|
130
|
+
- Open Library is always on. Add Google Books, LibriVox, or Audible enrichment with:
|
|
131
|
+
```bash
|
|
132
|
+
bookbot provider set-key googlebooks YOUR_API_KEY
|
|
133
|
+
bookbot provider enable librivox
|
|
134
|
+
bookbot provider enable audible
|
|
135
|
+
bookbot provider list
|
|
136
|
+
```
|
|
137
|
+
- Audible marketplace defaults to US; switch with `bookbot provider set-marketplace UK`.
|
|
138
|
+
|
|
139
|
+
**Convert and normalize**
|
|
140
|
+
- Install FFmpeg, then enable the conversion profile or pass `--profile conversion`.
|
|
141
|
+
- Stream copy AAC sources when possible, or set bitrate/VBR/normalization flags per run.
|
|
142
|
+
- Chapters can come from tags, track order, or custom names depending on your config.
|
|
143
|
+
|
|
144
|
+
**DRM tooling**
|
|
145
|
+
- Detect protection on folders of files with `bookbot drm detect ./library --recursive`.
|
|
146
|
+
- Store activation bytes once using `bookbot drm set-activation-bytes DEADBEAF`.
|
|
147
|
+
- Remove DRM in place or to a clean output location using `bookbot drm remove book.aax -o ./clean`.
|
|
148
|
+
|
|
149
|
+
## CLI cheat sheet
|
|
150
|
+
|
|
151
|
+
| Command | Purpose |
|
|
152
|
+
| --- | --- |
|
|
153
|
+
| `bookbot scan DIR` | Inspect directories, infer series/disc structure, and surface warnings without touching files. |
|
|
154
|
+
| `bookbot tui DIR...` | Launch the interactive Textual interface to match metadata, approve rename plans, and start conversions. Add `--metadata-from-files` to reuse local NFO/JSON sidecars instead of online providers. |
|
|
155
|
+
| `bookbot convert DIR -o OUT` | Build single-file, chaptered M4B releases with optional normalization and artwork. |
|
|
156
|
+
| `bookbot history --days 7` | Review completed transactions and identify undo candidates. |
|
|
157
|
+
| `bookbot undo ID` | Roll back an operation safely using its transaction identifier. |
|
|
158
|
+
| `bookbot provider ...` | Enable, disable, and configure metadata providers and API keys. |
|
|
159
|
+
| `bookbot config ...` | Manage global config, reset defaults, and inspect profile settings stored under `~/.config/bookbot`. |
|
|
160
|
+
| `bookbot audible ...` | Authenticate, list your library, and download titles directly from Audible. |
|
|
161
|
+
| `bookbot drm ...` | Detect DRM, save activation bytes, and convert protected files. |
|
|
162
|
+
| `bookbot completions SHELL` | Generate shell completions (bash, zsh, fish, or all). |
|
|
163
|
+
|
|
164
|
+
Use `--help` on any command or subgroup for the full option set.
|
|
165
|
+
|
|
166
|
+
## Configuration directory layout
|
|
167
|
+
|
|
168
|
+
| Location | Purpose |
|
|
169
|
+
| --- | --- |
|
|
170
|
+
| `~/.config/bookbot/config.toml` | Primary configuration file persisted by the TUI and CLI. |
|
|
171
|
+
| `~/.config/bookbot/profiles/*.toml` | Saved profiles, including the bundled `safe`, `full`, `plex`, and `conversion` presets. |
|
|
172
|
+
| `~/.cache/bookbot/` | Cached metadata, cover art, and conversion plans. Delete to force fresh lookups. |
|
|
173
|
+
| `~/.local/share/bookbot/transactions.json` | Transaction history used for undo and audit logs. |
|
|
174
|
+
|
|
175
|
+
Config files use TOML; edit by hand or via `bookbot config` commands.
|
|
176
|
+
|
|
177
|
+
## Metadata providers
|
|
178
|
+
|
|
179
|
+
| Provider | Notes |
|
|
180
|
+
| --- | --- |
|
|
181
|
+
| Open Library | Default, always enabled, free. Core search source for titles and authors. |
|
|
182
|
+
| Google Books | Requires an API key; adds richer descriptions and ISBN data. |
|
|
183
|
+
| LibriVox | Public domain library; great for narrator and language hints. |
|
|
184
|
+
| Audible | Requires authentication; unlocks commercial metadata and download tooling. |
|
|
185
|
+
|
|
186
|
+
Provider priorities and fallback logic are configurable through the `ConfigManager`. Combine multiple providers for higher confidence matches.
|
|
187
|
+
|
|
188
|
+
## Conversion pipeline
|
|
189
|
+
|
|
190
|
+
The conversion subsystem lives in `bookbot.convert` and wraps FFmpeg (through `ffmpeg-python`) to build high quality, chaptered M4B files. Highlights:
|
|
191
|
+
|
|
192
|
+
- Auto-detects when stream copy is safe to avoid re-encoding AAC tracks.
|
|
193
|
+
- Supports bitrate or VBR quality targets with optional EBU R128 loudness normalization.
|
|
194
|
+
- Generates chapter markers from track segmentation or existing tags.
|
|
195
|
+
- Embeds cover art and metadata pulled from the selected provider record.
|
|
196
|
+
- Writes conversion plans to disk so you can dry-run before touching anything (`bookbot convert --dry-run`).
|
|
197
|
+
|
|
198
|
+
## DRM and Audible helpers
|
|
199
|
+
|
|
200
|
+
BookBot includes a focused DRM toolkit backed by `ffmpeg` and the `audible` Python package.
|
|
201
|
+
|
|
202
|
+
1. Authenticate once with `bookbot audible auth`; credentials are stored securely via `keyring`.
|
|
203
|
+
2. List your library (`bookbot audible list --limit 50`) or import specific titles by ASIN.
|
|
204
|
+
3. Use `bookbot drm detect` to map protected files and `bookbot drm remove` to produce DRM-free audio. Activation bytes can be supplied per run or cached via `bookbot drm set-activation-bytes`.
|
|
205
|
+
|
|
206
|
+
### Retrieving Activation Bytes
|
|
207
|
+
|
|
208
|
+
For DRM removal of Audible files, you'll need your account's activation bytes. BookBot can retrieve these for you.
|
|
209
|
+
|
|
210
|
+
**Dependencies:**
|
|
211
|
+
|
|
212
|
+
This feature requires `selenium` and `chromedriver`. If you are not using the Docker image, you will need to install them:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
pip install selenium
|
|
216
|
+
# Make sure chromedriver is in your PATH
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
**Usage:**
|
|
220
|
+
|
|
221
|
+
Run the following command and follow the prompts to enter your Audible username and password:
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
bookbot audible get-activation-bytes
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
This will securely save your activation bytes for future use. After this one-time setup, you can remove DRM from your books without needing to provide the activation bytes every time.
|
|
228
|
+
|
|
229
|
+
These features depend on optional packages (`audible`, `cryptography`, `keyring`, `selenium`) that are already declared in `pyproject.toml`. Ensure FFmpeg is compiled with the modules required for Audible AAX/AAXC processing.
|
|
230
|
+
|
|
231
|
+
## Development
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
make install-dev # install dev dependencies
|
|
235
|
+
make lint # ruff + mypy
|
|
236
|
+
make format # black
|
|
237
|
+
make test # pytest
|
|
238
|
+
make pre-commit # run the full formatting and lint bundle
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Textual ships with a live reload server: run `textual run --dev bookbot.tui.app:BookBotApp` while editing the TUI.
|
|
242
|
+
|
|
243
|
+
## Contributing
|
|
244
|
+
|
|
245
|
+
We welcome issues and pull requests. Please:
|
|
246
|
+
|
|
247
|
+
1. Fork the repo and create a feature branch.
|
|
248
|
+
2. Add or update tests under `tests/` for any new functionality.
|
|
249
|
+
3. Run `make pre-commit` before submitting to keep style and typing checks green.
|
|
250
|
+
4. Document user-facing changes in this README or the changelog if applicable.
|
|
251
|
+
|
|
252
|
+
## License
|
|
253
|
+
|
|
254
|
+
BookBot is released under the MIT License. See [LICENSE](LICENSE) for the full text.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""BookBot - A cross-platform TUI audiobook renamer and organizer."""
|
|
2
|
+
|
|
3
|
+
__version__ = "0.3.0"
|
|
4
|
+
__author__ = "itsbryanman"
|
|
5
|
+
__email__ = "itsbryanman@users.noreply.github.com"
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main() -> None:
|
|
9
|
+
"""Main entry point for BookBot."""
|
|
10
|
+
from .cli import main as cli_main
|
|
11
|
+
|
|
12
|
+
cli_main()
|