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.
This commit is contained in:
parent
fff76a4be0
commit
d77274c2ea
1 changed files with 7 additions and 1 deletions
|
|
@ -99,7 +99,13 @@ class MetadataCache:
|
||||||
def _is_junk_entity(self, fields: dict) -> bool:
|
def _is_junk_entity(self, fields: dict) -> bool:
|
||||||
"""Check if extracted fields represent junk/placeholder data."""
|
"""Check if extracted fields represent junk/placeholder data."""
|
||||||
name = (fields.get('name') or '').strip().lower()
|
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:
|
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."""
|
"""Store an entity in the cache. Extracts structured fields from raw_data."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue