Fix null boolean error and playlist count showing 0 after restart

- Added all required boolean fields to MediaSources (IsRemote, IsInfiniteStream, RequiresOpening, etc)
- UpdateSpotifyPlaylistCounts now loads from file cache if Redis is empty
- This fixes 'type Null is not a subtype of type bool' error in Finamp
- Playlist counts now show correctly even after container restart
This commit is contained in:
2026-02-04 15:32:18 -05:00
parent 8091d30602
commit 7c92515723
2 changed files with 25 additions and 3 deletions

View File

@@ -2744,7 +2744,7 @@ public class JellyfinController : ControllerBase
var matchedTracksKey = $"spotify:matched:ordered:{playlistName}"; var matchedTracksKey = $"spotify:matched:ordered:{playlistName}";
var matchedTracks = await _cache.GetAsync<List<MatchedTrack>>(matchedTracksKey); var matchedTracks = await _cache.GetAsync<List<MatchedTrack>>(matchedTracksKey);
_logger.LogInformation("Cache lookup for {Key}: {Count} matched tracks", _logger.LogDebug("Cache lookup for {Key}: {Count} matched tracks",
matchedTracksKey, matchedTracks?.Count ?? 0); matchedTracksKey, matchedTracks?.Count ?? 0);
// Fallback to legacy cache format // Fallback to legacy cache format
@@ -2759,7 +2759,22 @@ public class JellyfinController : ControllerBase
Position = i, Position = i,
MatchedSong = s MatchedSong = s
}).ToList(); }).ToList();
_logger.LogInformation("Loaded {Count} tracks from legacy cache", matchedTracks.Count); _logger.LogDebug("Loaded {Count} tracks from legacy cache", matchedTracks.Count);
}
}
// Try loading from file cache if Redis is empty
if (matchedTracks == null || matchedTracks.Count == 0)
{
var fileItems = await LoadPlaylistItemsFromFile(playlistName);
if (fileItems != null && fileItems.Count > 0)
{
_logger.LogInformation("💿 Loaded {Count} playlist items from file cache for count update", fileItems.Count);
// Use file cache count directly
itemDict["ChildCount"] = fileItems.Count;
modified = true;
updatedItems.Add(itemDict);
continue;
} }
} }

View File

@@ -319,7 +319,14 @@ public class JellyfinResponseBuilder
["Protocol"] = "File", ["Protocol"] = "File",
["SupportsDirectStream"] = true, ["SupportsDirectStream"] = true,
["SupportsTranscoding"] = true, ["SupportsTranscoding"] = true,
["SupportsDirectPlay"] = true ["SupportsDirectPlay"] = true,
["IsRemote"] = false,
["IsInfiniteStream"] = false,
["RequiresOpening"] = false,
["RequiresClosing"] = false,
["RequiresLooping"] = false,
["SupportsProbing"] = true,
["ReadAtNativeFramerate"] = false
} }
}; };
} }