Add enhanced logging for lyrics fetching to debug Jellyfin embedded lyrics check
Some checks failed
CI / build-and-test (push) Has been cancelled

- Log when GetLyrics endpoint is called with itemId
- Log external vs local track determination
- Log Jellyfin lyrics check status code and result
- Will help identify why embedded lyrics aren't being found
This commit is contained in:
2026-02-07 20:00:19 -05:00
parent 56f2eca867
commit 6c06c59f61

View File

@@ -1144,12 +1144,17 @@ public class JellyfinController : ControllerBase
[HttpGet("Items/{itemId}/Lyrics")] [HttpGet("Items/{itemId}/Lyrics")]
public async Task<IActionResult> GetLyrics(string itemId) public async Task<IActionResult> GetLyrics(string itemId)
{ {
_logger.LogInformation("🎵 GetLyrics called for itemId: {ItemId}", itemId);
if (string.IsNullOrWhiteSpace(itemId)) if (string.IsNullOrWhiteSpace(itemId))
{ {
return NotFound(); return NotFound();
} }
var (isExternal, provider, externalId) = _localLibraryService.ParseSongId(itemId); var (isExternal, provider, externalId) = _localLibraryService.ParseSongId(itemId);
_logger.LogInformation("🎵 Lyrics request: itemId={ItemId}, isExternal={IsExternal}, provider={Provider}, externalId={ExternalId}",
itemId, isExternal, provider, externalId);
// For local tracks, check if Jellyfin already has embedded lyrics // For local tracks, check if Jellyfin already has embedded lyrics
if (!isExternal) if (!isExternal)
@@ -1159,13 +1164,16 @@ public class JellyfinController : ControllerBase
// Try to get lyrics from Jellyfin first (it reads embedded lyrics from files) // Try to get lyrics from Jellyfin first (it reads embedded lyrics from files)
var (jellyfinLyrics, statusCode) = await _proxyService.GetJsonAsync($"Audio/{itemId}/Lyrics", null, Request.Headers); var (jellyfinLyrics, statusCode) = await _proxyService.GetJsonAsync($"Audio/{itemId}/Lyrics", null, Request.Headers);
_logger.LogInformation("Jellyfin lyrics check result: statusCode={StatusCode}, hasLyrics={HasLyrics}",
statusCode, jellyfinLyrics != null);
if (jellyfinLyrics != null && statusCode == 200) if (jellyfinLyrics != null && statusCode == 200)
{ {
_logger.LogInformation("Found embedded lyrics in Jellyfin for track {ItemId}", itemId); _logger.LogInformation("Found embedded lyrics in Jellyfin for track {ItemId}", itemId);
return new JsonResult(JsonSerializer.Deserialize<object>(jellyfinLyrics.RootElement.GetRawText())); return new JsonResult(JsonSerializer.Deserialize<object>(jellyfinLyrics.RootElement.GetRawText()));
} }
_logger.LogInformation("No embedded lyrics found in Jellyfin, trying Spotify/LRCLIB"); _logger.LogInformation("No embedded lyrics found in Jellyfin (status: {StatusCode}), trying Spotify/LRCLIB", statusCode);
} }
// Get song metadata for lyrics search // Get song metadata for lyrics search