feat: wire real YouTube adapter into the registry
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
from lyra_worker.adapters._ytdlp import YtDlpClient
|
||||
from lyra_worker.adapters.base import SourceAdapter
|
||||
from lyra_worker.adapters.fakes import FakeQobuz, FakeSoulseek, FakeYouTube
|
||||
from lyra_worker.adapters.youtube import YouTubeAdapter
|
||||
|
||||
|
||||
def build_adapters() -> list[SourceAdapter]:
|
||||
"""The enabled source adapters, best-tier first.
|
||||
"""The enabled real source adapters, best-tier first.
|
||||
|
||||
SWAP POINT: Plan 3 replaces these fakes with real Qobuz/Soulseek/YouTube
|
||||
adapters (reading credentials from config). Nothing else in the pipeline changes.
|
||||
Only real, usable adapters are returned. Plan 3c/3d add Qobuz (streamrip)
|
||||
and Soulseek (slskd), each gated on its config being present via health().
|
||||
"""
|
||||
return [FakeQobuz(), FakeSoulseek(), FakeYouTube()]
|
||||
return [YouTubeAdapter(YtDlpClient())]
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
from lyra_worker.adapters.youtube import YouTubeAdapter
|
||||
from lyra_worker.registry import build_adapters
|
||||
|
||||
|
||||
def test_registry_returns_the_three_fake_sources():
|
||||
def test_registry_returns_real_youtube_adapter():
|
||||
adapters = build_adapters()
|
||||
names = sorted(a.name for a in adapters)
|
||||
assert names == ["qobuz", "soulseek", "youtube"]
|
||||
for a in adapters:
|
||||
assert a.health() is True
|
||||
names = [a.name for a in adapters]
|
||||
assert "youtube" in names
|
||||
yt = next(a for a in adapters if a.name == "youtube")
|
||||
assert isinstance(yt, YouTubeAdapter)
|
||||
assert yt.tier == 2
|
||||
assert yt.health() is True
|
||||
|
||||
|
||||
def test_registry_adapter_names_are_unique():
|
||||
names = [a.name for a in build_adapters()]
|
||||
assert len(names) == len(set(names))
|
||||
|
||||
Reference in New Issue
Block a user