Read embedded ASIN/ISBN tags during scan (fixes Rescan Metadata for tagged files)#781
Open
dny238 wants to merge 2 commits into
Open
Read embedded ASIN/ISBN tags during scan (fixes Rescan Metadata for tagged files)#781dny238 wants to merge 2 commits into
dny238 wants to merge 2 commits into
Conversation
…obook Files imported with an embedded ASIN (the freeform iTunes atom ----:com.apple.iTunes:ASIN that Audible rips and most audiobook taggers write) started life in the library with no identifier, so "Rescan Metadata" failed with "No ASIN or ISBN identifiers are available" even though the value was sitting in the file. - FfprobeTagMetadataMapper.Apply now reads the ASIN and ISBN tags into AudioMetadata (GetTag already matches case-insensitively). - AudiobookFileService.EnsureAudiobookFileAsync — the shared file- registration path used by the scan job — now adopts those identifiers onto the audiobook when it has none, persists, and records a history entry. Existing identifiers are never overwritten. Because AudiobookIdentifierMapper.GetEffectiveIdentifiers backfills from the legacy Asin/Isbn fields, this is enough for Rescan Metadata to work. - Adds FfprobeTagMetadataMapperTests covering ASIN/ISBN extraction, case-insensitivity, absent-tag, and no-overwrite. Fixes Listenarrs#780 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The initial change only adopted identifiers when a *new* AudiobookFile was created. Re-scanning a file that was already imported (e.g. after tagging it with an ASIN) returned early before the adoption ran, so the identifier was never picked up. Now, when a file is already registered and the audiobook still has no ASIN, the scan re-reads the file's tags and adopts an identifier. Guarded on a missing ASIN so the extra ffprobe read only happens when there's something to gain. 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.
Fixes #780
Problem
When ListenArr scans an existing audio file that has an ASIN embedded in its tags (the freeform iTunes atom
----:com.apple.iTunes:ASINthat Audible rips and most audiobook taggers write), the ASIN is never extracted. The imported audiobook gets no identifier, and Rescan Metadata then fails immediately with "No ASIN or ISBN identifiers are available for metadata rescan" — even though the value is sitting in the file.Root cause:
FfprobeTagMetadataMapper.Apply()maps title/artist/album/track/disc/year but never reads the ASIN (or ISBN) tag.Fix
FfprobeTagMetadataMapper.Apply()now reads theASINandISBNtags intoAudioMetadata.AudioMetadataalready hadAsin/Isbnproperties, andGetTagalready matches case-insensitively (so the----:com.apple.iTunes:ASINatom, which ffprobe surfaces asASIN, is picked up).AudiobookFileService.EnsureAudiobookFileAsync()— the shared file-registration path the scan job uses — now adopts those identifiers onto the audiobook when it has none, persists via the audiobook repository, and records a history entry. Existing identifiers are never overwritten. SinceAudiobookIdentifierMapper.GetEffectiveIdentifiersbackfills from the legacyAsin/Isbnfields, setting them is sufficient for Rescan Metadata to succeed.Scope / notes
Tests
FfprobeTagMetadataMapperTests: ASIN + ISBN extraction, case-insensitive ASIN match, absent-tag leavesnull, and existing ASIN not overwritten.dotnet buildclean (0 warnings). Related suites (Files / Scanning / Ffmpeg / Metadata) — 174/174 pass.🤖 Generated with Claude Code