fix: Spotify lyrics validation and proactive prefetching

- Only attempt Spotify lyrics for tracks with valid Spotify IDs (22 chars, no 'local' or ':')
- Add Spotify IDs to external matched tracks in playlists for lyrics support
- Proactively fetch and cache lyrics when playback starts (background task)
- Fix pre-existing SubSonicController bug (missing _cache field)
- Lyrics now ready instantly when requested by client
This commit is contained in:
2026-02-06 13:04:40 -05:00
parent fbac81df64
commit c54503f486
3 changed files with 213 additions and 23 deletions

View File

@@ -28,6 +28,7 @@ public class SubsonicController : ControllerBase
private readonly SubsonicModelMapper _modelMapper;
private readonly SubsonicProxyService _proxyService;
private readonly PlaylistSyncService? _playlistSyncService;
private readonly RedisCacheService _cache;
private readonly ILogger<SubsonicController> _logger;
public SubsonicController(
@@ -39,6 +40,7 @@ public class SubsonicController : ControllerBase
SubsonicResponseBuilder responseBuilder,
SubsonicModelMapper modelMapper,
SubsonicProxyService proxyService,
RedisCacheService cache,
ILogger<SubsonicController> logger,
PlaylistSyncService? playlistSyncService = null)
{
@@ -51,6 +53,7 @@ public class SubsonicController : ControllerBase
_modelMapper = modelMapper;
_proxyService = proxyService;
_playlistSyncService = playlistSyncService;
_cache = cache;
_logger = logger;
if (string.IsNullOrWhiteSpace(_subsonicSettings.Url))