Fix Deezer metadata cache returning incomplete data for track details

Deezer search results (cached without release_date, track_position, isrc)
were being served by get_track_details as cache hits, preventing the actual
/track/{id} API call that returns complete data. This caused $year template
variable to remain empty even with the discovery worker fix in place.
This commit is contained in:
Broque Thomas 2026-03-17 13:14:08 -07:00
parent 6759f68b2b
commit d31bba8999

View file

@ -354,7 +354,11 @@ class DeezerClient:
cache = get_metadata_cache()
cached = cache.get_entity('deezer', 'track', str(track_id))
if cached and cached.get('title'):
return self._build_enhanced_track(cached)
# Search results are cached with minimal data (no release_date, track_position).
# Only use cache if it has fields that the /track/{id} endpoint provides.
if 'release_date' in cached or 'track_position' in cached or 'isrc' in cached:
return self._build_enhanced_track(cached)
# Otherwise fall through to fetch full data from API
data = self._api_get(f'track/{track_id}')
if not data: