Skip to content

Read embedded ASIN/ISBN tags during scan (fixes Rescan Metadata for tagged files)#781

Open
dny238 wants to merge 1 commit into
Listenarrs:canaryfrom
dny238:fix/scan-read-asin-tag
Open

Read embedded ASIN/ISBN tags during scan (fixes Rescan Metadata for tagged files)#781
dny238 wants to merge 1 commit into
Listenarrs:canaryfrom
dny238:fix/scan-read-asin-tag

Conversation

@dny238

@dny238 dny238 commented Jul 24, 2026

Copy link
Copy Markdown

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:ASIN that 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 the ASIN and ISBN tags into AudioMetadata. AudioMetadata already had Asin/Isbn properties, and GetTag already matches case-insensitively (so the ----:com.apple.iTunes:ASIN atom, which ffprobe surfaces as ASIN, 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. Since AudiobookIdentifierMapper.GetEffectiveIdentifiers backfills from the legacy Asin/Isbn fields, setting them is sufficient for Rescan Metadata to succeed.

Scope / notes

  • Adopts only when the audiobook is missing the identifier — no clobbering of user- or metadata-supplied values.
  • Follows the issue's suggested approach (steps 1–3). ISBN is included alongside ASIN so nothing the mapper reads goes unused.

Tests

  • New FfprobeTagMetadataMapperTests: ASIN + ISBN extraction, case-insensitive ASIN match, absent-tag leaves null, and existing ASIN not overwritten.
  • dotnet build clean (0 warnings). Related suites (Files / Scanning / Ffmpeg / Metadata) — 174/174 pass.

🤖 Generated with Claude Code

…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 <[email protected]>
@dny238
dny238 requested a review from a team July 24, 2026 20:53
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.

ASIN not read from audio file tags during library scan — files with embedded ASIN get no identifier

1 participant