fix: extract Spotify track ID from Odesli entityUniqueId format

- Odesli returns entityUniqueId as 'SPOTIFY_SONG::trackid'
- Now extracts just the track ID part after '::'
- Fixes Spotify lyrics not working due to invalid ID format
- Spotify lyrics service expects clean track IDs like '0PgYPBGqF6Wm5KFHQ81nq5'
This commit is contained in:
2026-02-07 12:05:55 -05:00
parent bb46db43b1
commit 47b9427c20

View File

@@ -302,11 +302,18 @@ public class SquidWTFMetadataService : IMusicMetadataService
platforms.TryGetProperty("spotify", out var spotifyPlatform) && platforms.TryGetProperty("spotify", out var spotifyPlatform) &&
spotifyPlatform.TryGetProperty("entityUniqueId", out var spotifyIdEl)) spotifyPlatform.TryGetProperty("entityUniqueId", out var spotifyIdEl))
{ {
song.SpotifyId = spotifyIdEl.GetString(); var rawSpotifyId = spotifyIdEl.GetString();
// Odesli returns format "SPOTIFY_SONG::trackid", extract just the track ID
if (!string.IsNullOrEmpty(rawSpotifyId))
{
song.SpotifyId = rawSpotifyId.Contains("::")
? rawSpotifyId.Split("::")[1]
: rawSpotifyId;
_logger.LogInformation("✓ Converted squidwtf/{ExternalId} → Spotify ID {SpotifyId}", externalId, song.SpotifyId); _logger.LogInformation("✓ Converted squidwtf/{ExternalId} → Spotify ID {SpotifyId}", externalId, song.SpotifyId);
} }
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogDebug(ex, "Failed to convert Tidal track to Spotify ID via Odesli"); _logger.LogDebug(ex, "Failed to convert Tidal track to Spotify ID via Odesli");