From 7e9a6dd72da5caf9070e3639ee72c676a683430f Mon Sep 17 00:00:00 2001 From: V1ck3s Date: Fri, 12 Dec 2025 17:16:32 +0100 Subject: [PATCH] fix: song order --- octo-fiesta/Controllers/SubSonicController.cs | 50 +++++++++++-------- 1 file changed, 30 insertions(+), 20 deletions(-) diff --git a/octo-fiesta/Controllers/SubSonicController.cs b/octo-fiesta/Controllers/SubSonicController.cs index b4e02de..7134b03 100644 --- a/octo-fiesta/Controllers/SubSonicController.cs +++ b/octo-fiesta/Controllers/SubSonicController.cs @@ -808,29 +808,39 @@ public class SubsonicController : ControllerBase return newElement; } - private object ConvertSongToSubsonicJson(Song song) + private Dictionary ConvertSongToSubsonicJson(Song song) { - return new + var result = new Dictionary { - id = song.Id, - parent = song.AlbumId ?? "", - isDir = false, - title = song.Title, - album = song.Album, - artist = song.Artist, - albumId = song.AlbumId, - artistId = song.ArtistId, - duration = song.Duration ?? 0, - track = song.Track ?? 0, - year = song.Year ?? 0, - coverArt = song.Id, - suffix = song.IsLocal ? "mp3" : "Remote", - bitRate = song.IsLocal ? (int?)null : 0, - contentType = "audio/mpeg", - type = "music", - isVideo = false, - isExternal = !song.IsLocal + ["id"] = song.Id, + ["parent"] = song.AlbumId ?? "", + ["isDir"] = false, + ["title"] = song.Title, + ["album"] = song.Album ?? "", + ["artist"] = song.Artist ?? "", + ["albumId"] = song.AlbumId ?? "", + ["artistId"] = song.ArtistId ?? "", + ["duration"] = song.Duration ?? 0, + ["track"] = song.Track ?? 0, + ["year"] = song.Year ?? 0, + ["coverArt"] = song.Id, + ["suffix"] = song.IsLocal ? "mp3" : "Remote", + ["contentType"] = "audio/mpeg", + ["type"] = "music", + ["isVideo"] = false, + ["isExternal"] = !song.IsLocal }; + + if (song.IsLocal) + { + result["bitRate"] = 128; // Default for local files + } + else + { + result["bitRate"] = 0; + } + + return result; } private object ConvertAlbumToSubsonicJson(Album album)