mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
fix: song order
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user