feat(discovery): build_similarity_sources + worker sweep/trigger wiring
Adds registry.build_similarity_sources() (always constructs ListenBrainzSource; reachability is a per-run health() concern, not a startup gate) and wires discovery into the worker's main loop: a scheduled sweep gated on discover.enabled + DISCOVER_TICK_SECONDS, and a one-shot discover.requested trigger mirroring the existing scan.requested pattern. Also hardens run_discovery's health-check pass: a source whose health() raises is now logged and skipped instead of aborting the whole sweep (accepted finding from the Task-3 review). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -12,6 +12,8 @@ from lyra_worker.adapters.youtube import YouTubeAdapter
|
||||
from lyra_worker.browser import MbBrowser
|
||||
from lyra_worker.probe import AudioProbe
|
||||
from lyra_worker.resolver import MbResolver
|
||||
from lyra_worker.similarity._listenbrainz import ListenBrainzSource
|
||||
from lyra_worker.similarity.base import SimilaritySource
|
||||
from lyra_worker.tagger import Tagger
|
||||
|
||||
|
||||
@@ -47,3 +49,9 @@ def build_browser() -> MbBrowser:
|
||||
def build_probe() -> AudioProbe:
|
||||
"""The audio probe used by the library scan."""
|
||||
return MutagenProbe()
|
||||
|
||||
|
||||
def build_similarity_sources(config: dict) -> list[SimilaritySource]:
|
||||
"""Similarity sources for discovery. ListenBrainz needs no credentials, so it is
|
||||
always constructed; per-run reachability is checked via each source's health()."""
|
||||
return [ListenBrainzSource(base_url=config.get("discover.listenBrainzUrl") or "")]
|
||||
|
||||
Reference in New Issue
Block a user