fix(bindery): stop deriving a book's series from its own title#121
Merged
Conversation
Three compounding defects made Bindery imports come out with
series = the book's own title (the "Good Guys" incident):
- The bare-trailing-number heuristic ("Dukes and Ladders 5.epub")
fabricated series=title and typed novels as chapters. It now only
applies to comic formats; prose ebooks keep the index but no series.
- The real series name in "(Series Book N)" parentheticals — standard
Amazon/Calibre naming — was deleted as noise before parsing. It is
now parsed first ("(The Bad Guys Book 8)", "(Cradle, Book 1)",
"(Series #7)").
- The review UI extracted embedded metadata (calibre:series etc.) on
preview and then discarded it; only the filename guess reached the
form. file_metadata now merges into the form before the candidate
auto-apply, with the same file-beats-filename precedence auto-import
has always had (single review + Match All).
The parser also understands the organizer's "NN. Title - Author (Year)"
layout, so the review form now pre-fills the author (and auto-import
uses it as fallback when nothing is embedded).
Verified end-to-end via fixture EPUBs through the review flow: the
original incident shape now lands as series="The Good Guys" idx 5.
859 tests green (13 new parser regressions incl. the literal prod
filename), frontend build clean.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Books imported through the Bindery review flow could come out with their series set to their own title (the "Good Guys" incident: 4 EPUBs each landed as series="" instead of "The Good Guys"). Three defects compounded:
Dukes and Ladders 5.epub→ series "Dukes and Ladders", content type "chapter". That convention is right for manga (One Piece 1050.cbz) but wrong for prose.(The Bad Guys Book 8)-style parentheticals — the standard Amazon/Calibre naming — were stripped as noise. A prod file literally carried the correct series in its name and lost it./bindery/previewextractscalibre:series(and EPUB3 collections) intofile_metadata, but the frontend discarded it — only the filename guess reached the form, and the external candidate apply kept it whenever the candidate had no series.Fix
filename_parser.py: parse(Series Book N)/(Series, Book N)/(Series #N)before noise-stripping; understand the organizer'sNN. Title - Author (Year)layout (now extracting the author, which the review form previously always left blank); bare trailing numbers on EPUB/PDF set the index but no longer fabricate a series — CBZ/CBR keep the chapter convention.BinderyPage.tsx: merge embeddedfile_metadatainto the review form before the candidate auto-apply — same "file beats filename" precedence auto-import has always had. Applies to single review and Match All.bindery.py: list endpoint returns the parsed author;main.pyauto-import uses it as a fallback when nothing is embedded.Verification
tsc -bbuild clean.Dukes and Ladders 5.epubwith embeddedcalibre:series) now lands as series="The Good Guys" idx 5;(Cradle, Book 1)parses from the parenthetical;07. Back to One - Eric Ugland (2021).epubpre-fills author.Deliberately untouched (pre-existing): the review screen auto-applies the top external candidate with no confidence gate — a book absent from the catalogs can still get confidently wrong metadata. Worth its own issue if it bites.