Fix bitrate showing 0K for favorited songs and browse views
Some checks failed
CI / build-and-test (push) Has been cancelled

- Ensure MediaSources field is included when proxying browse requests
- Applies to /Users/{userId}/Items (favorites, recently played, etc)
- Jellyfin doesn't include MediaSources by default, must be requested
- Now bitrate info shows correctly in all browse contexts
This commit is contained in:
2026-02-03 20:04:10 -05:00
parent a2a48f6ed9
commit 4229924f61

View File

@@ -123,10 +123,23 @@ public class JellyfinController : ControllerBase
// Build the full endpoint path with query string // Build the full endpoint path with query string
var endpoint = userId != null ? $"Users/{userId}/Items" : "Items"; var endpoint = userId != null ? $"Users/{userId}/Items" : "Items";
if (Request.QueryString.HasValue)
// Ensure MediaSources is included in Fields parameter for bitrate info
var queryString = Request.QueryString.Value ?? "";
if (!queryString.Contains("Fields=", StringComparison.OrdinalIgnoreCase))
{ {
endpoint = $"{endpoint}{Request.QueryString.Value}"; // No Fields parameter, add MediaSources
queryString = string.IsNullOrEmpty(queryString)
? "?Fields=MediaSources"
: $"{queryString}&Fields=MediaSources";
} }
else if (!queryString.Contains("MediaSources", StringComparison.OrdinalIgnoreCase))
{
// Fields parameter exists but doesn't include MediaSources, append it
queryString = $"{queryString},MediaSources";
}
endpoint = $"{endpoint}{queryString}";
var (browseResult, statusCode) = await _proxyService.GetJsonAsync(endpoint, null, Request.Headers); var (browseResult, statusCode) = await _proxyService.GetJsonAsync(endpoint, null, Request.Headers);