fix: add missing Jellyfin fields to external tracks

Added PlaylistItemId, DateCreated, ParentId, Tags, People, and SortName fields to match real Jellyfin item structure for Spotify playlist tracks.
This commit is contained in:
2026-02-10 11:55:07 -05:00
parent b69625dc2e
commit 6a39184b01

View File

@@ -263,9 +263,11 @@ public class JellyfinResponseBuilder
["Name"] = songTitle, ["Name"] = songTitle,
["ServerId"] = "allstarr", ["ServerId"] = "allstarr",
["Id"] = song.Id, ["Id"] = song.Id,
["PlaylistItemId"] = song.Id, // Required for playlist items
["HasLyrics"] = false, // Could be enhanced to check if lyrics exist ["HasLyrics"] = false, // Could be enhanced to check if lyrics exist
["Container"] = "flac", ["Container"] = "flac",
["PremiereDate"] = song.Year.HasValue ? $"{song.Year}-01-01T00:00:00.0000000Z" : null, ["PremiereDate"] = song.Year.HasValue ? $"{song.Year}-01-01T00:00:00.0000000Z" : null,
["DateCreated"] = song.Year.HasValue ? $"{song.Year}-01-01T00:00:00.0000000Z" : DateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ"),
["RunTimeTicks"] = (song.Duration ?? 0) * TimeSpan.TicksPerSecond, ["RunTimeTicks"] = (song.Duration ?? 0) * TimeSpan.TicksPerSecond,
["ProductionYear"] = song.Year, ["ProductionYear"] = song.Year,
["IndexNumber"] = song.Track, ["IndexNumber"] = song.Track,
@@ -273,6 +275,7 @@ public class JellyfinResponseBuilder
["IsFolder"] = false, ["IsFolder"] = false,
["Type"] = "Audio", ["Type"] = "Audio",
["ChannelId"] = (object?)null, ["ChannelId"] = (object?)null,
["ParentId"] = song.AlbumId,
["Genres"] = !string.IsNullOrEmpty(song.Genre) ["Genres"] = !string.IsNullOrEmpty(song.Genre)
? new[] { song.Genre } ? new[] { song.Genre }
: new string[0], : new string[0],
@@ -286,6 +289,9 @@ public class JellyfinResponseBuilder
} }
} }
: new Dictionary<string, object?>[0], : new Dictionary<string, object?>[0],
["Tags"] = new string[0],
["People"] = new object[0],
["SortName"] = songTitle,
["ParentLogoItemId"] = song.AlbumId, ["ParentLogoItemId"] = song.AlbumId,
["ParentBackdropItemId"] = song.AlbumId, ["ParentBackdropItemId"] = song.AlbumId,
["ParentBackdropImageTags"] = new string[0], ["ParentBackdropImageTags"] = new string[0],