mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
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:
@@ -302,8 +302,15 @@ 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();
|
||||||
_logger.LogInformation("✓ Converted squidwtf/{ExternalId} → Spotify ID {SpotifyId}", externalId, song.SpotifyId);
|
// 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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user