From b778b3d31eae447d1245100c71a4b722ed3505fe Mon Sep 17 00:00:00 2001 From: Josh Patra Date: Wed, 4 Feb 2026 16:04:04 -0500 Subject: [PATCH] Fix MediaSources null array fields and add logging for artist albums - Added MediaStreams, MediaAttachments, Formats as empty arrays instead of null - Added RunTimeTicks field to MediaSources - Added detailed logging to GetExternalChildItems to debug artist album issues - This should fix 'type Null is not a subtype of type List' error --- allstarr/Controllers/JellyfinController.cs | 7 +++++++ allstarr/Services/Jellyfin/JellyfinResponseBuilder.cs | 6 +++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/allstarr/Controllers/JellyfinController.cs b/allstarr/Controllers/JellyfinController.cs index a4c2138..35ddc91 100644 --- a/allstarr/Controllers/JellyfinController.cs +++ b/allstarr/Controllers/JellyfinController.cs @@ -598,9 +598,13 @@ public class JellyfinController : ControllerBase { var itemTypes = ParseItemTypes(includeItemTypes); + _logger.LogInformation("GetExternalChildItems: provider={Provider}, externalId={ExternalId}, itemTypes={ItemTypes}", + provider, externalId, string.Join(",", itemTypes ?? Array.Empty())); + // Check if asking for audio (album tracks) if (itemTypes?.Contains("Audio") == true) { + _logger.LogDebug("Fetching album tracks for {Provider}/{ExternalId}", provider, externalId); var album = await _metadataService.GetAlbumAsync(provider, externalId); if (album == null) { @@ -611,9 +615,12 @@ public class JellyfinController : ControllerBase } // Otherwise assume it's artist albums + _logger.LogDebug("Fetching artist albums for {Provider}/{ExternalId}", provider, externalId); var albums = await _metadataService.GetArtistAlbumsAsync(provider, externalId); var artist = await _metadataService.GetArtistAsync(provider, externalId); + _logger.LogInformation("Found {Count} albums for artist {ArtistName}", albums.Count, artist?.Name ?? "unknown"); + // Fill artist info if (artist != null) { diff --git a/allstarr/Services/Jellyfin/JellyfinResponseBuilder.cs b/allstarr/Services/Jellyfin/JellyfinResponseBuilder.cs index 5d11014..9f58939 100644 --- a/allstarr/Services/Jellyfin/JellyfinResponseBuilder.cs +++ b/allstarr/Services/Jellyfin/JellyfinResponseBuilder.cs @@ -326,7 +326,11 @@ public class JellyfinResponseBuilder ["RequiresClosing"] = false, ["RequiresLooping"] = false, ["SupportsProbing"] = true, - ["ReadAtNativeFramerate"] = false + ["ReadAtNativeFramerate"] = false, + ["MediaStreams"] = new List(), // Empty array instead of null + ["MediaAttachments"] = new List(), // Empty array instead of null + ["Formats"] = new List(), // Empty array instead of null + ["RunTimeTicks"] = (song.Duration ?? 180) * 10000000L // Duration in ticks (100ns units) } }; }