From acb44793138917d441043af7d64c664f28e29f80 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Fri, 10 Apr 2026 17:11:42 -0700 Subject: [PATCH] Re-discover tracks with incomplete metadata in playlist pipeline The discovery worker skipped already-discovered tracks even when their matched_data was incomplete (missing track_number, release_date, album ID). These stale discoveries from before the enrichment fix would persist forever, causing the automation pipeline to keep producing tracks with no year, no track numbers, and no cover art. Now treats discovered tracks as undiscovered if they're missing track_number AND have no release_date or album ID, so the enriched discovery pipeline fills in the gaps on the next run. --- web_server.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/web_server.py b/web_server.py index 57d5373a..b029d03c 100644 --- a/web_server.py +++ b/web_server.py @@ -32432,8 +32432,20 @@ def _run_playlist_discovery_worker(playlists, automation_id=None): except (json.JSONDecodeError, TypeError): pass if existing_extra.get('discovered'): - pl_skipped += 1 - total_skipped += 1 + # Check if matched_data is complete — old discoveries may be missing + # track_number/release_date due to the Track dataclass stripping them. + # Re-discover these so the enriched pipeline fills in the gaps. + md = existing_extra.get('matched_data', {}) + album = md.get('album', {}) + has_track_num = md.get('track_number') + has_release = album.get('release_date') if isinstance(album, dict) else None + has_album_id = album.get('id') if isinstance(album, dict) else None + if has_track_num and (has_release or has_album_id): + pl_skipped += 1 + total_skipped += 1 + else: + # Incomplete discovery — re-discover to get full metadata + undiscovered_tracks.append(track) else: undiscovered_tracks.append(track)