diff --git a/allstarr/Controllers/AdminController.cs b/allstarr/Controllers/AdminController.cs index 6017e29..db9896c 100644 --- a/allstarr/Controllers/AdminController.cs +++ b/allstarr/Controllers/AdminController.cs @@ -486,6 +486,54 @@ public class AdminController : ControllerBase _logger.LogWarning("Playlist {Name} has no JellyfinId configured", config.Name); } + // Get lyrics completion status + try + { + var tracks = await _playlistFetcher.GetPlaylistTracksAsync(config.Name); + if (tracks.Count > 0) + { + var lyricsWithCount = 0; + var lyricsWithoutCount = 0; + + foreach (var track in tracks) + { + var cacheKey = $"lyrics:{track.PrimaryArtist}:{track.Title}:{track.Album}:{track.DurationMs / 1000}"; + var existingLyrics = await _cache.GetStringAsync(cacheKey); + + if (!string.IsNullOrEmpty(existingLyrics)) + { + lyricsWithCount++; + } + else + { + lyricsWithoutCount++; + } + } + + playlistInfo["lyricsTotal"] = tracks.Count; + playlistInfo["lyricsCached"] = lyricsWithCount; + playlistInfo["lyricsMissing"] = lyricsWithoutCount; + playlistInfo["lyricsPercentage"] = tracks.Count > 0 + ? (int)Math.Round((double)lyricsWithCount / tracks.Count * 100) + : 0; + } + else + { + playlistInfo["lyricsTotal"] = 0; + playlistInfo["lyricsCached"] = 0; + playlistInfo["lyricsMissing"] = 0; + playlistInfo["lyricsPercentage"] = 0; + } + } + catch (Exception ex) + { + _logger.LogWarning(ex, "Failed to get lyrics completion for playlist {Name}", config.Name); + playlistInfo["lyricsTotal"] = 0; + playlistInfo["lyricsCached"] = 0; + playlistInfo["lyricsMissing"] = 0; + playlistInfo["lyricsPercentage"] = 0; + } + playlists.Add(playlistInfo); } diff --git a/allstarr/wwwroot/index.html b/allstarr/wwwroot/index.html index 8008b02..d61a8f4 100644 --- a/allstarr/wwwroot/index.html +++ b/allstarr/wwwroot/index.html @@ -662,13 +662,14 @@