184df1594e
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
874 B
Python
27 lines
874 B
Python
"""Media-Steuerung — plattformspezifische Backends hinter gemeinsamem Interface."""
|
|
|
|
import sys
|
|
from typing import Protocol, runtime_checkable
|
|
|
|
|
|
@runtime_checkable
|
|
class MediaController(Protocol):
|
|
async def pause(self) -> None: ...
|
|
async def resume(self) -> None: ...
|
|
|
|
|
|
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.
|
|
"""
|
|
if not enabled:
|
|
from whisper_local.media._noop import NoopController
|
|
return NoopController()
|
|
if sys.platform == "linux":
|
|
from whisper_local.media._mpris import MprisController
|
|
return MprisController()
|
|
from whisper_local.media._noop import NoopController
|
|
return NoopController()
|