mirror of
https://github.com/SoPat712/allstarr.git
synced 2026-02-09 23:55:10 -05:00
Preserve MediaSources metadata for local tracks in playlists to show bitrate
This commit is contained in:
@@ -99,4 +99,10 @@ public class Song
|
||||
/// 0 = Naturally clean, 1 = Explicit, 2 = Not applicable, 3 = Clean/edited version, 6/7 = Unknown
|
||||
/// </summary>
|
||||
public int? ExplicitContentLyrics { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Raw Jellyfin metadata (MediaSources, etc.) for local tracks
|
||||
/// Preserved to maintain bitrate and other technical details
|
||||
/// </summary>
|
||||
public Dictionary<string, object?>? JellyfinMetadata { get; set; }
|
||||
}
|
||||
|
||||
@@ -187,6 +187,14 @@ public class JellyfinModelMapper
|
||||
// Cover art URL construction
|
||||
song.CoverArtUrl = $"/Items/{id}/Images/Primary";
|
||||
|
||||
// Preserve Jellyfin metadata (MediaSources, etc.) for local tracks
|
||||
// This ensures bitrate and other technical details are maintained
|
||||
song.JellyfinMetadata = new Dictionary<string, object?>();
|
||||
if (item.TryGetProperty("MediaSources", out var mediaSources))
|
||||
{
|
||||
song.JellyfinMetadata["MediaSources"] = JsonSerializer.Deserialize<object>(mediaSources.GetRawText());
|
||||
}
|
||||
|
||||
return song;
|
||||
}
|
||||
|
||||
|
||||
@@ -323,6 +323,11 @@ public class JellyfinResponseBuilder
|
||||
}
|
||||
};
|
||||
}
|
||||
else if (song.IsLocal && song.JellyfinMetadata != null && song.JellyfinMetadata.ContainsKey("MediaSources"))
|
||||
{
|
||||
// Use preserved Jellyfin metadata for local tracks to maintain bitrate info
|
||||
item["MediaSources"] = song.JellyfinMetadata["MediaSources"];
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(song.Genre))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user