2 Commits

Author SHA1 Message Date
Denis Defolie 2a4f434f01 Fix MPRIS player never listed when it signals during an attach attempt
An attach attempt subscribes to PropertiesChanged before its initial read.
A signal arriving during that read called _schedule(), which cancelled the
pending add task (the one running the attempt) and replaced it with a
refresh of a player that was never registered: the player stayed unlisted
and no further attempt was made. The signal handler now acts only on a
registered player.

Found through an intermittently failing test; a deterministic regression
test blocks the first read, emits the signal, then releases it. It fails
without the fix, and test_mpris went from about 1 failure in 8 to 0 in 40.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 15:51:19 +01:00
Denis cd4a8a797b Fix MPRIS player detection: browsers, relaunched and slow players
Players were silently lost, so the Playing tab showed no controls:

- Chromium and Brave answer MPRIS calls but return an empty introspection,
  which made dbus-next fail with "interface not found". The MPRIS interfaces
  are now described statically (MPRIS 2 spec) instead of read from the player.
- A player relaunched under the same bus name (Dragon Player, Celluloid...)
  left its old object subscribed to PropertiesChanged; that signal cancelled
  the pending attach of the new one. Player.close() now unsubscribes.
- A player may take its name long before it answers (objects exported later,
  or a main loop busy opening a file read over the network). Attaching is now
  retried while the name stays on the bus, with a per-attempt timeout, and is
  cancelled when the player leaves. MprisManager.stop() cancels everything.

tests/test_mpris.py runs on a private dbus-daemon and covers each case; the
relaunch, empty-introspection and late-player tests fail without the fixes.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 16:28:08 +01:00