Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 1.61 KB

README.md

File metadata and controls

24 lines (20 loc) · 1.61 KB

Overdrive Chapterizer

Simple Python script to extract chapters from Overdrive MP3 tracks into a .txt file for processing by m4b-tool or equivalent.

Usage

python3 chapters.py [-m Manual Mode, one directory at a time] [-a Automatic mode, all subdirectories] [-l List folders without chapters] <audiobook_directory>

In manual mode, supply one directory and the program will look one layer deep for MP3 files. If it finds any sharing names but named for parts, it will iterate through them, extracting chapters and putting them into a chapters.txt file in the same directory.

In automatic mode, provide a directory which the program will look into two layers deep, and search for MP3 tracks in sub-sub folders, then extract chapters and put them in their respective files. For instance:

Audiobooks/
├── Harry Potter and the Sorcerer's Stone/
│   ├── Harry Potter and the Sorcerer's Stone-Part01.mp3
│   ├── Harry Potter and the Sorcerer's Stone-Part02.mp3
│   ├── Harry Potter and the Sorcerer's Stone-Part03.mp3
│   └── chapters.txt (generated by this script)
├── 1984/
└── A Wrinkle in Time/

In list mode, the program will run in the same way as automatic mode, but will instead only list sub-sub-directories without chapter.txt files.

Once you have extracted the chapter data, you can use a utility like m4b-tool to combine the MP3 tracks into an M4B file, and the program will use chapters.txt if it in the same directory. The program also filters out "faux chapters" Overdrive sometimes inserts.