feat: production-ready Linux & macOS support
- Add `linux` (dbus-python, PyGObject, python-xlib) and `macos`
(pyobjc) extras to pyproject.toml with sys_platform markers; move
cross-platform screen-brightness-control + monitorcontrol to base deps.
- build-dist-linux.sh: install `.[linux]`, pkg-config pre-flight for
dbus-1/glib-2.0, emit a systemd unit with DBUS_SESSION_BUS_ADDRESS +
XDG_RUNTIME_DIR + ReadWritePaths for ~/.config and ~/.cache so MPRIS
works and audit-log / thumbnail writes aren't blocked by ProtectHome.
- New build-dist-macos.sh + per-user LaunchAgent installer producing
MediaServer-vX.Y-macos-{arm64,x86_64}.tar.gz.
- Templated media-server.service updated to match the dist layout with
proper session-bus env vars and a writable state-dir grant.
- install_linux.sh: drop dead requirements.txt path; install via
`pip install ".[linux]"` and pre-create the writable state dirs.
- Cross-platform album artwork: abstract MediaController.get_album_art()
with Linux (mpris:artUrl, file:// + http(s)://) and macOS (Spotify URL)
impls; routes/media artwork endpoint now awaits the controller.
- LinuxMediaController connects to the session bus lazily — failure no
longer crashes lifespan startup; MPRIS calls return idle until the bus
is reachable. Logged once at INFO with a hint about
`loginctl enable-linger`.
- Startup preflight on Linux warns if DBUS_SESSION_BUS_ADDRESS or
XDG_RUNTIME_DIR is unset and informs the user when Wayland disables
the foreground probe.
- /api/media/visualizer/status now reports a per-OS unavailable_reason.
- tray._confirm guarded against ctypes.windll on non-Windows.
- config.example.yaml: per-OS commented script examples; on_turn_off
default is now a no-op echo (used to silently fail off Windows).
- README: replace stale `pip install -r requirements.txt` instructions
with the new extras; add systemd lingering doc + troubleshooting
section; add macOS LaunchAgent section.
- CI: new linux-smoke job (installs `.[linux]`, boots the server under
dbus-run-session, asserts /api/health). Release workflow gains
apt-deps step for the Linux build and a best-effort macOS build job.
This commit is contained in:
+23
-6
@@ -34,19 +34,36 @@ dependencies = [
|
||||
"pillow>=10.0.0",
|
||||
"soundcard>=0.4.0",
|
||||
"numpy>=1.24.0,<2.0",
|
||||
# screen-brightness-control + monitorcontrol are cross-platform
|
||||
# (Windows / Linux i2c-dev). Kept in base deps so a plain
|
||||
# `pip install media-server` yields a working /api/display on any
|
||||
# platform that has the underlying hardware support.
|
||||
"screen-brightness-control>=0.20.0",
|
||||
"monitorcontrol>=3.0.0",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
windows = [
|
||||
"winsdk>=1.0.0b10",
|
||||
"pywin32>=306",
|
||||
"comtypes>=1.2.0",
|
||||
"pycaw>=20230407",
|
||||
"screen-brightness-control>=0.20.0",
|
||||
"wmi>=1.5.1",
|
||||
"monitorcontrol>=3.0.0",
|
||||
"pywin32>=306; sys_platform == 'win32'",
|
||||
"comtypes>=1.2.0; sys_platform == 'win32'",
|
||||
"pycaw>=20230407; sys_platform == 'win32'",
|
||||
"wmi>=1.5.1; sys_platform == 'win32'",
|
||||
"pystray>=0.19.0",
|
||||
]
|
||||
linux = [
|
||||
# MPRIS / D-Bus media control. Requires libdbus-1-dev, libglib2.0-dev,
|
||||
# and pkg-config installed on the host before pip install.
|
||||
"dbus-python>=1.3.2; sys_platform == 'linux'",
|
||||
"PyGObject>=3.46; sys_platform == 'linux'",
|
||||
# X11 foreground-window probe (Wayland sessions degrade gracefully).
|
||||
"python-xlib>=0.33; sys_platform == 'linux'",
|
||||
]
|
||||
macos = [
|
||||
# PyObjC for the foreground-window + active-app probes.
|
||||
"pyobjc-framework-Cocoa>=10.0; sys_platform == 'darwin'",
|
||||
"pyobjc-framework-Quartz>=10.0; sys_platform == 'darwin'",
|
||||
]
|
||||
dev = [
|
||||
"pytest>=7.0",
|
||||
"pytest-asyncio>=0.21",
|
||||
|
||||
Reference in New Issue
Block a user