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,8 +302,15 @@ public class SquidWTFMetadataService : IMusicMetadataService
platforms.TryGetProperty("spotify", out var spotifyPlatform) &&
spotifyPlatform.TryGetProperty("entityUniqueId", out var spotifyIdEl))
{
song.SpotifyId = spotifyIdEl.GetString();
_logger.LogInformation("✓ Converted squidwtf/{ExternalId} → Spotify ID {SpotifyId}", externalId, song.SpotifyId);
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);
}
}
}
}