Skip to content

Chapters: use file names when every file has the same title tag - #171

Open
NicolasHartmann wants to merge 1 commit into
rstewa:mainfrom
NicolasHartmann:fix/file-chapter-titles
Open

NicolasHartmann wants to merge 1 commit into
rstewa:mainfrom
NicolasHartmann:fix/file-chapter-titles

Conversation

@NicolasHartmann

Copy link
Copy Markdown

Problem

A multi-file audiobook gets one chapter per file that has no chapter marks, and that chapter is named after the file's title tag. Many multi-file books carry the same title tag on every file (usually the book title), so the chapter list shows the same entry over and over:

Harry Potter and the Philosopher's Stone (Full-Cast Edition)
Harry Potter and the Philosopher's Stone (Full-Cast Edition)
Harry Potter and the Philosopher's Stone (Full-Cast Edition)
...

It looks as if the names were cut off, but the stored titles really are identical (19 chapters, 1 distinct title in my library).

Fix

When the per-file chapters of a multi-file book cannot be told apart by their title tags (a tag is missing or repeated), they are named after their files instead:

Harry Potter and the Philosopher's Stone (Full-Cast Edition) - 01
Harry Potter and the Philosopher's Stone (Full-Cast Edition) - 02
...
  • Distinct title tags are kept as they are.
  • Chapters from real chapter marks inside a file are never renamed.
  • Single-file books are not touched.

The rule lives in FileChapterTitles.Resolve and is applied in two places: on import (CreateAudiobookFromMultipleFiles) and in the AudiobookViewModel constructor, so books that are already in the library show the right names without a re-import. The view model only changes the titles in memory; it does not write to the database by itself.

Testing

🤖 Generated with Claude Code

…peat

A multi-file audiobook gets one chapter per file without chapter marks,
named after the file's title tag. When every file carries the same tag
(often the book title), all entries in the chapter list looked identical.
Those chapters now use the file name. Applied on import and when a book
is loaded, so already imported books are covered too.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants