Key Tidal track identity on ISRC for capture de-dup

to_proto now emits the recording's ISRC as provider_item_id (falling back
to the numeric track id when absent). Two Tidal track objects for the same
recording share an ISRC, so capturing the same song reached via different
Tidal paths de-duplicates by provider id to one store entry. The library
path still uses the numeric id.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Test User 2026-07-22 22:35:45 +02:00
parent 6ca8607586
commit 95ea1e44a0
1 changed files with 10 additions and 1 deletions

View File

@ -212,7 +212,16 @@ impl Track {
album: self.album.clone().map(|a| a.into()),
duration: self.duration.map(|d| d as u32 * 1000),
is_skipped: false,
provider_item_id: self.id.to_string(),
// Prefer the ISRC (the recording identity) so the same recording
// reached via different Tidal track ids — album vs single vs
// compilation — de-duplicates in the content store; fall back to
// the track id when the listing omits it. The library `path`
// above still uses the numeric track id, so streaming resolves.
provider_item_id: self
.isrc
.clone()
.filter(|isrc| !isrc.is_empty())
.unwrap_or_else(|| self.id.to_string()),
is_captured: false,
}
}