From d77274c2ea96b1a3eb9fa908d8f565ee9c75cb87 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Sun, 12 Apr 2026 09:27:17 -0700 Subject: [PATCH] Reject tracks with Unknown Artist from metadata cache The junk entity filter checked track name but not artist_name, allowing tracks like "Woman Like You by Unknown Artist" to be cached. Now rejects any track or album where artist_name matches the junk names list (unknown, unknown artist, empty, null, etc). Prevents stale incomplete data from persisting across retries. --- core/metadata_cache.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/core/metadata_cache.py b/core/metadata_cache.py index 5f468124..50d547de 100644 --- a/core/metadata_cache.py +++ b/core/metadata_cache.py @@ -99,7 +99,13 @@ class MetadataCache: def _is_junk_entity(self, fields: dict) -> bool: """Check if extracted fields represent junk/placeholder data.""" name = (fields.get('name') or '').strip().lower() - return name in self._JUNK_NAMES + if name in self._JUNK_NAMES: + return True + # For tracks: reject if artist_name is junk (prevents caching "Song by Unknown Artist") + artist_name = (fields.get('artist_name') or '').strip().lower() + if artist_name and artist_name in self._JUNK_NAMES: + return True + return False def store_entity(self, source: str, entity_type: str, entity_id: str, raw_data: dict) -> None: """Store an entity in the cache. Extracts structured fields from raw_data."""