Add Hydrabase as a searchable tab in multi-source enhanced search
Hydrabase appears as a switchable source tab alongside Spotify/iTunes/ Deezer when connected and enabled. Added to alternate_sources list and enhanced-search/source endpoint. Tab only shows when Hydrabase is available — zero change when disconnected.
This commit is contained in:
parent
2f9491c71b
commit
214985482d
1 changed files with 10 additions and 1 deletions
|
|
@ -7002,6 +7002,8 @@ def enhanced_search():
|
||||||
|
|
||||||
# Determine which alternate sources are available (for frontend to fetch async)
|
# Determine which alternate sources are available (for frontend to fetch async)
|
||||||
spotify_available = bool(spotify_client and spotify_client.is_spotify_authenticated())
|
spotify_available = bool(spotify_client and spotify_client.is_spotify_authenticated())
|
||||||
|
hydrabase_available = bool(hydrabase_client and hydrabase_client.is_connected()
|
||||||
|
and (dev_mode_enabled or config_manager.get('hydrabase.enabled', False)))
|
||||||
alternate_sources = []
|
alternate_sources = []
|
||||||
if primary_source != 'spotify' and spotify_available:
|
if primary_source != 'spotify' and spotify_available:
|
||||||
alternate_sources.append('spotify')
|
alternate_sources.append('spotify')
|
||||||
|
|
@ -7009,6 +7011,8 @@ def enhanced_search():
|
||||||
alternate_sources.append('itunes')
|
alternate_sources.append('itunes')
|
||||||
if primary_source != 'deezer':
|
if primary_source != 'deezer':
|
||||||
alternate_sources.append('deezer')
|
alternate_sources.append('deezer')
|
||||||
|
if primary_source != 'hydrabase' and hydrabase_available:
|
||||||
|
alternate_sources.append('hydrabase')
|
||||||
|
|
||||||
logger.info(f"Enhanced search results ({primary_source}): {len(db_artists)} DB artists, "
|
logger.info(f"Enhanced search results ({primary_source}): {len(db_artists)} DB artists, "
|
||||||
f"{len(primary_results['artists'])} artists, {len(primary_results['albums'])} albums, "
|
f"{len(primary_results['artists'])} artists, {len(primary_results['albums'])} albums, "
|
||||||
|
|
@ -7091,7 +7095,7 @@ def enhanced_search_source(source_name):
|
||||||
Called asynchronously by the frontend after the primary search returns.
|
Called asynchronously by the frontend after the primary search returns.
|
||||||
Each source tab fires its own request so slow sources don't block fast ones.
|
Each source tab fires its own request so slow sources don't block fast ones.
|
||||||
"""
|
"""
|
||||||
if source_name not in ('spotify', 'itunes', 'deezer'):
|
if source_name not in ('spotify', 'itunes', 'deezer', 'hydrabase'):
|
||||||
return jsonify({"error": f"Unknown source: {source_name}"}), 400
|
return jsonify({"error": f"Unknown source: {source_name}"}), 400
|
||||||
|
|
||||||
data = request.get_json()
|
data = request.get_json()
|
||||||
|
|
@ -7111,6 +7115,11 @@ def enhanced_search_source(source_name):
|
||||||
client = iTunesClient()
|
client = iTunesClient()
|
||||||
elif source_name == 'deezer':
|
elif source_name == 'deezer':
|
||||||
client = _get_deezer_client()
|
client = _get_deezer_client()
|
||||||
|
elif source_name == 'hydrabase':
|
||||||
|
if hydrabase_client and hydrabase_client.is_connected():
|
||||||
|
client = hydrabase_client
|
||||||
|
else:
|
||||||
|
return jsonify({"artists": [], "albums": [], "tracks": [], "available": False})
|
||||||
|
|
||||||
result = _enhanced_search_source(query, client)
|
result = _enhanced_search_source(query, client)
|
||||||
return jsonify(result)
|
return jsonify(result)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue