fix: song order

This commit is contained in:
V1ck3s
2025-12-12 17:16:32 +01:00
committed by Vickes
parent bdbafb4669
commit 7e9a6dd72d

View File

@@ -808,29 +808,39 @@ public class SubsonicController : ControllerBase
return newElement; return newElement;
} }
private object ConvertSongToSubsonicJson(Song song) private Dictionary<string, object> ConvertSongToSubsonicJson(Song song)
{ {
return new var result = new Dictionary<string, object>
{ {
id = song.Id, ["id"] = song.Id,
parent = song.AlbumId ?? "", ["parent"] = song.AlbumId ?? "",
isDir = false, ["isDir"] = false,
title = song.Title, ["title"] = song.Title,
album = song.Album, ["album"] = song.Album ?? "",
artist = song.Artist, ["artist"] = song.Artist ?? "",
albumId = song.AlbumId, ["albumId"] = song.AlbumId ?? "",
artistId = song.ArtistId, ["artistId"] = song.ArtistId ?? "",
duration = song.Duration ?? 0, ["duration"] = song.Duration ?? 0,
track = song.Track ?? 0, ["track"] = song.Track ?? 0,
year = song.Year ?? 0, ["year"] = song.Year ?? 0,
coverArt = song.Id, ["coverArt"] = song.Id,
suffix = song.IsLocal ? "mp3" : "Remote", ["suffix"] = song.IsLocal ? "mp3" : "Remote",
bitRate = song.IsLocal ? (int?)null : 0, ["contentType"] = "audio/mpeg",
contentType = "audio/mpeg", ["type"] = "music",
type = "music", ["isVideo"] = false,
isVideo = false, ["isExternal"] = !song.IsLocal
isExternal = !song.IsLocal
}; };
if (song.IsLocal)
{
result["bitRate"] = 128; // Default for local files
}
else
{
result["bitRate"] = 0;
}
return result;
} }
private object ConvertAlbumToSubsonicJson(Album album) private object ConvertAlbumToSubsonicJson(Album album)