Commit Graph

2 Commits (743c504918dd4780a5529802ce2c210de6d18c52)

Author SHA1 Message Date
Sean Doran 3c0c9adc83
fix: always apply PA stream volume for app/group knobs
MPRIS set_volume returning True was causing an early return that
silently skipped the PulseAudio stream write. PA-only apps like
Brave and Vesktop (registered as Chromium/electron) never had their
volume updated when any MPRIS player coincidentally matched the
target name by substring.

Both set_app_volume and reapply_app_volumes now always apply the PA
correction regardless of MPRIS result, so PA-only and MPRIS-capable
apps are handled correctly in all cases.
2026-03-20 19:45:11 -04:00
Sean Doran 1552d73412
Refactor: extract audio.py, add 50 unit tests
- Extract MPRISController and PulseController into src/turnup/audio.py;
  turnupd.py imports from there, dropping ~270 lines of duplicated code
- Add [project.optional-dependencies] dev = [pytest] and pytest testpaths
  to pyproject.toml
- Add tests/test_audio.py: 31 tests covering MPRISController player
  matching, volume clamping, cache TTL, and PulseController MPRIS-first
  routing, PA fallback, and drain_events
- Add tests/test_protocol.py: 19 tests covering parse_messages framing,
  multi-message buffers, garbage skipping, and knob conversion helpers
- All 50 tests pass (pytest 9.0, Python 3.14)
2026-02-27 18:40:13 -05:00