From 95ea1e44a009464874db5cbdeda15eb8f7249200 Mon Sep 17 00:00:00 2001 From: Test User Date: Wed, 22 Jul 2026 22:35:45 +0200 Subject: [PATCH] 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) --- tidaldy/src/models.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tidaldy/src/models.rs b/tidaldy/src/models.rs index 39f67d4..f4f935a 100644 --- a/tidaldy/src/models.rs +++ b/tidaldy/src/models.rs @@ -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, } }