From d597123a40205667b41150ddebd8816c719156db Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 7 Apr 2026 08:45:01 -0700 Subject: [PATCH] Add Discogs to enrichment service whitelist Discogs was missing from valid_services, _enrichment_locks, and _run_single_enrichment handler. The Enrich button on the enhanced library page returned "service must be one of" error when Discogs was selected. Added handler using _process_item pattern matching other batch-style workers, with guard against track-level enrichment. --- web_server.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/web_server.py b/web_server.py index d1e169a0..3f45a821 100644 --- a/web_server.py +++ b/web_server.py @@ -12982,7 +12982,7 @@ def library_play_track(): print(f"❌ Error playing library track: {e}") return jsonify({"success": False, "error": str(e)}), 500 -_enrichment_locks = {svc: threading.Lock() for svc in ('audiodb', 'deezer', 'musicbrainz', 'spotify', 'itunes', 'lastfm', 'genius', 'tidal', 'qobuz')} +_enrichment_locks = {svc: threading.Lock() for svc in ('audiodb', 'deezer', 'musicbrainz', 'spotify', 'itunes', 'lastfm', 'genius', 'tidal', 'qobuz', 'discogs')} @app.route('/api/library/enrich', methods=['POST']) def library_enrich_entity(): @@ -13008,7 +13008,7 @@ def library_enrich_entity(): if entity_type not in ('artist', 'album', 'track'): return jsonify({"success": False, "error": "entity_type must be artist, album, or track"}), 400 - valid_services = ('audiodb', 'deezer', 'musicbrainz', 'spotify', 'itunes', 'lastfm', 'genius', 'tidal', 'qobuz') + valid_services = ('audiodb', 'deezer', 'musicbrainz', 'spotify', 'itunes', 'lastfm', 'genius', 'tidal', 'qobuz', 'discogs') if service not in valid_services: return jsonify({"success": False, "error": f"service must be one of: {', '.join(valid_services)}"}), 400 @@ -13174,6 +13174,17 @@ def _run_single_enrichment(service, entity_type, entity_id, name, artist_name): qobuz_enrichment_worker._process_track(entity_id, name, artist_name, item) return {"success": True, "message": f"Qobuz lookup complete for {entity_type}"} + elif service == 'discogs': + if not discogs_worker: + return {"success": False, "error": "Discogs worker not initialized"} + item = {'type': entity_type, 'id': entity_id, 'name': name} + if entity_type in ('album', 'track'): + item['artist'] = artist_name + if entity_type == 'track': + return {"success": False, "error": "Discogs does not support track-level enrichment"} + discogs_worker._process_item(item) + return {"success": True, "message": f"Discogs lookup complete for {entity_type}"} + else: return {"success": False, "error": f"Unknown service: {service}"}