Preserve MediaSources metadata for local tracks in playlists to show bitrate

This commit is contained in:
2026-02-03 19:35:39 -05:00
parent a0bbb7cd4c
commit 64ac09becf
3 changed files with 19 additions and 0 deletions

View File

@@ -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; }
}

View File

@@ -186,6 +186,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;
}

View File

@@ -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))
{