- Development in progress, until now the Tools folder has all the useful scripts. - An audiobook toolbox launcher designed specifically to help with managing Audiobookshelf self-hosted service.*
This is a collection of tools I wrote to help me manage audiobook files. In the process of ripping your collection or downloading files, often times the formatting is at odds with the expectations of services like Audiobookshelf, which is what I use. Hopefully you find these tools helpful in renaming, splitting, repairing, organizing, etc. I am working on a main app that pulls the tools all into one working tool, but in the meantime all tools in the Tools folder are fully functional with detailed user prompts, file summaries, progress bars, error handling, and much more. Everything I found useful to get my library in working order.
A single-file Python launcher that puts a friendly menu in front of a dozen standalone audiobook-management scripts. Designed for people who maintain their own library (Audiobookshelf, Plex, a shelf of ripped CDs) and find themselves doing the same handful of cleanup tasks over and over.
- πͺ Split & extract β slice long audio files into equal chunks, extract segments by time, split m4b files by chapter
- π§΅ Join β merge Libation-style chapter files (and cover art) into a single audiobook
- π Organize β flatten multi-disc folder structures into clean flat libraries
- βοΈ Rename β add prefixes, strip junk, collapse Part/Chapter/Subchapter numbering
- π§Ή Metadata & repair β clear ID3 tags, re-encode corrupt MP3s
- π Library management β full scanner/fixer for an Audiobookshelf root
Every tool is standalone and can be run directly. Rhapsode just provides a menu.
| Requirement | Used by | |
|---|---|---|
| π | Python 3.8 or later | Launcher + every .py tool |
| π¬ | ffmpeg + ffprobe on your PATH | Any tool that touches audio |
Only needed for the specific tools that use them:
| Package | Install | Used by |
|---|---|---|
mutagen |
pip install mutagen |
clear_mp3_metadata.py, audiobook_manager.py |
rapidfuzz |
pip install rapidfuzz |
audiobook_manager.py |
rich |
pip install rich |
audiobook_manager.py |
π‘ You don't actually have to pre-install these.
audiobook_manager.pyauto-prompts to install its own dependencies on first run.
| Platform | Command |
|---|---|
| πͺ Windows | python.org installer (check Add to PATH) or winget install Python.Python.3 |
| π macOS | brew install python |
| π§ Linux | sudo apt install python3 (or your distro's equivalent) |
Verify:
python --versionThe engine behind almost every audio operation. You need both ffmpeg and ffprobe on your PATH.
# πͺ Windows
winget install ffmpeg
# π macOS
brew install ffmpeg
# π§ Ubuntu / Debian
sudo apt install ffmpeg
# π§ Arch
sudo pacman -S ffmpegVerify:
ffmpeg -version
ffprobe -versionpip install mutagen rapidfuzz richOr use:
python -m pip install mutagen rapidfuzz richgit clone https://github.com/julescools/rhapsode.git
cd rhapsodepython rhapsode.pyπ Done.
rhapsode/
βββ π rhapsode.py β the launcher (sits here)
βββ π Tools/ β all the workhorse scripts
βββ audiobook_manager.py
βββ audiobook_splitter_extraction_tool.py
βββ extract_m4b_chapter_audio_files.py
βββ join_libation_m4b_files_..._.py
βββ combine_audio_ffmpeg.bat
βββ audiobook_take_all_files_..._.py
βββ PretextEdit_..._.py
βββ rename_part_chapter_subchapter_..._.py
βββ remove_first_space.bat
βββ clear_mp3_metadata.py
βββ repair_mp3.py
π Rhapsode discovers tools by exact filename. If you rename a file in Tools/, update the matching filename= entry in the CATEGORIES list near the top of rhapsode.py.
cd "/path/to/my/audiobook"
python /path/to/rhapsode/rhapsode.pyBy default, the target directory (where the tools operate) is your current working directory β usually the book you're working on. Change it at any time with d.
| Key | Action |
|---|---|
1 β N |
|
d |
π Change target directory |
i |
βΉοΈ Show details about a tool |
s |
π Status β list all tools, flag any missing files |
q |
πͺ Quit |
Ctrl+C |
βΉ Interrupt a running tool and return to the menu |
- Audiobook Library Manager β full scanner/fixer for an Audiobookshelf root. Scan cache, corrupt-file detection, batch renames, fuzzy-match cleanup. This is the big one.
- Slice or extract segment β split one file into equal chunks, extract a segment by start/end time, or split by chapter markers. Uses
-c copyβ no re-encoding, no quality loss. - Extract m4b chapters (parallel) β for each
.m4bin the target dir, extract every chapter into its own file, multi-threaded with live progress.
- Join Libation m4b parts + cover β merge all
.m4bfiles in a directory into one audiobook, preserving chapter markers and embeddingcover.jpg. - Combine audio files (batch, Windows) β ffmpeg concat example in a
.bat.β οΈ Currently hardcoded to one specific trilogy β edit before use.
- Flatten multi-disc audiobook folders β take
Disc 1 / Disc 2 / CD3 / β¦subfolders and collapse them into a single flat directory with renumbered tracks. Includes interactive disc-order review before anything is renamed. - Flatten multi-disc video folders β same logic, for video.
- PretextEdit β add a prefix to every file in the target directory, or across multiple selected subdirectories. Live preview of the first N renames before committing.
- Part/Chapter/Subchapter β sequential β collapse nested numbering like
Title 01 - 02 - 03.mp3into flatTitle - 001.mp3. (Originally written for Lolita; edit the regex for other titles.) - Strip text before first space (Windows) β removes everything up to the first space from every filename. Useful for stripping indexing junk.
- Clear all MP3 metadata β strips every ID3 tag from every
.mp3in the target dir. - Repair MP3 (re-encode) β re-encodes every
.mp3through ffmpeg to fix header/frame corruption. Keeps.backupfiles alongside.
Most tools use Path.cwd() to find their working directory, so Rhapsode just runs them as subprocesses with cwd=target_dir.
A few tools (PretextEdit, clear_mp3_metadata, join_libation, video flattener) resolve their working dir via __file__ β for those, Rhapsode briefly copies the script into the target directory as _rhapsode_<name>, runs it, and deletes the copy when it finishes.
π No tool in Tools/ is ever modified. The launcher is a dispatcher, not a rewrite. Each script can still be run standalone by cd-ing into a directory and invoking it directly.
β "ffmpeg not found"
ffmpeg or ffprobe isn't on your PATH. Install it (see above) and then close and reopen your terminal. On Windows, occasionally you need to log out and back in.
β A tool shows up as (missing) in the status list
The filename in Tools/ doesn't exactly match the filename= entry in CATEGORIES in rhapsode.py. Filenames are case-sensitive on macOS and Linux.
β οΈ "A previous temp copy already exists"
Rhapsode didn't clean up its temp copy from a previous crashed run. Look for _rhapsode_* in your target directory and delete it manually, then retry.
π₯ UnicodeEncodeError on Windows with non-ASCII filenames
Your console code page isn't UTF-8. The launcher reconfigures stdout/stderr automatically on modern Python, but if you hit this, run:
chcp 65001before launching.
π§ A tool needs a pip package I don't have
pip install mutagen rapidfuzz richThat's the full list across every tool in the toolbox.
- πͺΆ No tool is modified. Rhapsode is a dispatcher. Every script in
Tools/can still be run standalone. - ποΈ
-c copyeverywhere possible. The extract/split/join tools avoid re-encoding by default β you keep your source bitrate, tags, and cover art. - π€ Windows console safety. Stdout/stderr get reconfigured to UTF-8 on Windows to avoid the encoding crashes that show up with some Unicode filenames.
- π§© Adding your own tool. Drop a script into
Tools/, then add aTool(...)entry to the right category inCATEGORIESat the top ofrhapsode.py. Setneeds_copy=Trueif your script uses__file__to resolve its working directory.
MIT. Do whatever.
Built for people with way too many audiobooks.
ππ§