Repository navigation
Feat/mam title fallback - #37
Merged
Merged
Conversation
… snatched torrent Config/mam/title_fallback (default off). Every recent MAM-pass miss (Before She Knew Him and others) had both file-name searches return the release's own torrent, not yet marked my_snatched: the hook runs booktree minutes after the download and MAM sets the flag later. With the flag on, such a release gets one more MAM search in the title and author fields (main title, lower case, plus author names). Candidates need not be snatched, so each must have the release's file type, one of its authors and the same title (same numbers and subtitle, no bundle), and exactly one candidate must pass. The search shares the throttle, budget, session and cache of the file-name searches, whose text and cache keys are unchanged; it is skipped after a failed MAM request in the run and with verbose off (the ranking does not run then). JSON log: mam_attempt "title", query search "title-author". Replay harness: Config/mam is merged rather than replaced, and the offline MAM session has a real cookie jar (cookies=None made an uncached MAM search raise outside searchMAM's error handling and skip the book's Audible step). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017Ut2SJwyL9F8zUJHeM2GLP
Replaces mam/title_fallback (an extra title/author MAM search) with
mam/accept_unsnatched (default off), which makes no extra MAM request: the
file-name searches booktree already sends returned the release's own torrent,
only not yet marked my_snatched, because the hook runs booktree minutes after
the download and MAM sets the flag later.
With the flag on, when neither file-name search returns a snatched row,
getMAMBook also hands back the other rows and MAMBook.pickUnsnatched accepts
the one row (by MAM id, across both searches) that has the release's file
type, one of its authors and the same title (sameMamTitle: same numbers,
subtitle and production; no sibling volume, part or box set). Two or more are
ambiguous and none is used; a snatched row is preferred as before. stdout gets
one line ("No snatched MAM match; using the only unsnatched one ..."), the
JSON log mam_attempt "unsnatched" (match.attempt "mam-unsnatched").
Removed with the title search: searchMAMByTitle, the srchIn split of
searchMAM (back to upstream's body, unchanged text and cache key), the
per-run MAM-failure latch and the query helpers. Kept: _rowToBook, the title
check, the replay harness fixes (Config/mam merged, offline cookie jar).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Ut2SJwyL9F8zUJHeM2GLP
- samePosition: a "Book N" written in one title must agree with the other
title or with the other side's series parts (MAM series_info for the row,
the release's own series tags), else the row is refused ("Mother of
Learning, Book 2" is not a row MAM lists as part 3, nor one without a part).
- Pool key: rows without a MAM id each count on their own (a null id became
"None" and merged them, hiding an ambiguity).
- Pooled rows have control characters replaced before anything prints or
files them, and the silent title checks run before isThisMyAuthorsBook
(which prints the row title), so a row nobody chose cannot add lines to
stdout. Title/series inputs to the title regexes are clipped.
- CONFIG.md: the verbose/ebooks condition and the position check.
- Tests: position vs series part, id-less rows, control characters, a
snatched widened hit beating the pool, ebooks without verbose, JSON log.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017Ut2SJwyL9F8zUJHeM2GLP
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.
When MAM's filename search finds the release's torrent but MAM hasn't marked it snatched yet, booktree accepts it, provided it's the only candidate and its file type, author and title all match strictly. It makes no extra MAM requests and is controlled by Config/mam/accept_unsnatched, which ships as 0.