feat(media): Factory dispatcht auf win32 zum SmtcController
This commit is contained in:
@@ -14,8 +14,8 @@ def test_factory_returns_noop_when_disabled():
|
||||
assert isinstance(controller, NoopController)
|
||||
|
||||
|
||||
def test_factory_returns_noop_on_non_linux():
|
||||
with patch.object(sys, "platform", "win32"):
|
||||
def test_factory_returns_noop_on_other_platforms():
|
||||
with patch.object(sys, "platform", "darwin"):
|
||||
controller = create_media_controller(enabled=True)
|
||||
assert isinstance(controller, NoopController)
|
||||
|
||||
@@ -38,3 +38,11 @@ async def test_noop_controller_pause_is_noop():
|
||||
def test_noop_controller_satisfies_protocol():
|
||||
controller = NoopController()
|
||||
assert isinstance(controller, MediaController)
|
||||
|
||||
|
||||
@pytest.mark.skipif(sys.platform != "win32", reason="SmtcController nur auf Windows")
|
||||
def test_factory_returns_smtc_on_win32_when_enabled():
|
||||
from whisper_local.media._smtc import SmtcController
|
||||
|
||||
controller = create_media_controller(enabled=True)
|
||||
assert isinstance(controller, SmtcController)
|
||||
|
||||
@@ -13,8 +13,8 @@ class MediaController(Protocol):
|
||||
def create_media_controller(enabled: bool) -> MediaController:
|
||||
"""Erstellt den plattformspezifischen Media-Controller.
|
||||
|
||||
`enabled=False` → immer NoopController. Auf Nicht-Linux-Plattformen
|
||||
wird aktuell ebenfalls der NoopController zurückgegeben.
|
||||
`enabled=False` → immer NoopController. Auf nicht unterstützten Plattformen
|
||||
wird ebenfalls der NoopController zurückgegeben.
|
||||
"""
|
||||
if not enabled:
|
||||
from whisper_local.media._noop import NoopController
|
||||
@@ -22,5 +22,8 @@ def create_media_controller(enabled: bool) -> MediaController:
|
||||
if sys.platform == "linux":
|
||||
from whisper_local.media._mpris import MprisController
|
||||
return MprisController()
|
||||
if sys.platform == "win32":
|
||||
from whisper_local.media._smtc import SmtcController
|
||||
return SmtcController()
|
||||
from whisper_local.media._noop import NoopController
|
||||
return NoopController()
|
||||
|
||||
Reference in New Issue
Block a user