eonpatapon / mpDris2

MPRIS V2.1 support for mpd
GNU General Public License v3.0
214 stars 46 forks source link

Randomly stops responding to multimedia keys #58

Open zoqaeski opened 10 years ago

zoqaeski commented 10 years ago

Usually at least once a day, especially after resuming from a suspend, mpDris2 will appear to be working but not respond to multimedia keys. Interestingly enough I can still send commands to it via D-Bus.

I often use MPD's single mode to pause an album, and have Shift-Xf86AudioPlay bound to mpc single and Shift-Xf86AudioPrev bound to mpc seek 0 to restart a song (via Openbox). Could that be part of the problem? Using a modifier on the other multimedia keys doesn't seem to send the signal to mpDris2, even though the plain key will.

I'm using MATE desktop environment on Arch Linux x86-64, with Openbox as my window manager. I always get warnings about a failure to connect to GNOME Settings Daemon, but it seems to work.

Here's a typical debug log, if that will shed some insight:

$ mpDris2 --debug
2014-05-13 11:22:47,743 mpDris2 INFO: Using file:///mnt/music as music library path.
2014-05-13 11:22:47,743 mpDris2 INFO: Using Mutagen to read covers from music files.
2014-05-13 11:22:47,790 mpDris2 WARNING: Failed to connect to GNOME Settings Daemon. Media keys won't work.
2014-05-13 11:22:47,792 mpDris2 DEBUG: Sending command 'commands' (was idle? False)
2014-05-13 11:22:47,806 mpDris2 DEBUG: Sending command 'urlhandlers' (was idle? False)
2014-05-13 11:22:47,806 mpDris2 DEBUG: Connected to MPD server.
2014-05-13 11:22:47,814 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:22:47,815 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:22:47,816 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:22:47,816 mpDris2 DEBUG: Updated property: PlaybackStatus = Playing
2014-05-13 11:22:47,997 mpDris2 DEBUG: Updated property: Metadata = dbus.Dictionary({'xesam:album': 'The Brink', 'xesam:title': 'No Country', 'xesam:trackNumber': 6, 'xesam:contentCreated': '2014', 'xesam:discNumber': 1, 'mpris:trackid': dbus.ObjectPath('/org/mpris/MediaPlayer2/Track/40'), 'mpris:length': dbus.Int64(274000000L), 'mpris:artUrl': 'file:///mnt/music/Jezabels, The/2014 - The Brink/cover.jpg', 'xesam:artist': ['The Jezabels'], 'xesam:url': 'file:///mnt/music/Jezabels, The/2014 - The Brink/06. No Country.flac'}, signature=dbus.Signature('sv'))
2014-05-13 11:22:47,998 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:57,288 mpDris2 DEBUG: Left idle
2014-05-13 11:22:57,288 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:22:57,289 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:22:57,290 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:57,327 mpDris2 DEBUG: Left idle
2014-05-13 11:22:57,327 mpDris2 DEBUG: Sending command 'status' (was idle? True)
2014-05-13 11:22:57,328 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:57,367 mpDris2 DEBUG: Left idle
2014-05-13 11:22:57,367 mpDris2 DEBUG: Sending command 'pause' (was idle? True)
2014-05-13 11:22:57,431 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:57,433 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:22:57,434 mpDris2 DEBUG: Idle events: [{'changed': 'player'}]
2014-05-13 11:22:57,434 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:22:57,435 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:22:57,436 mpDris2 DEBUG: Updated property: PlaybackStatus = Paused
2014-05-13 11:22:57,436 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:57,437 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:22:57,437 mpDris2 DEBUG: Idle events: [{'changed': 'mixer'}]
2014-05-13 11:22:57,438 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:22:57,438 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:22:57,439 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:58,801 mpDris2 DEBUG: Left idle
2014-05-13 11:22:58,801 mpDris2 DEBUG: Sending command 'status' (was idle? True)
2014-05-13 11:22:58,802 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:58,840 mpDris2 DEBUG: Left idle
2014-05-13 11:22:58,841 mpDris2 DEBUG: Sending command 'play' (was idle? True)
2014-05-13 11:22:58,842 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:58,845 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:22:58,845 mpDris2 DEBUG: Idle events: [{'changed': 'player'}]
2014-05-13 11:22:58,845 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:22:58,847 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:22:58,848 mpDris2 DEBUG: Updated property: PlaybackStatus = Playing
2014-05-13 11:22:58,848 mpDris2 DEBUG: Expected pos 81.782, actual 80.805, diff -0.9769999999999897
2014-05-13 11:22:58,849 mpDris2 DEBUG: Old position was 80.782 at 1399944177 (1 seconds ago)
2014-05-13 11:22:58,849 mpDris2 DEBUG: Seeked to 80805000
2014-05-13 11:22:58,849 mpDris2 DEBUG: Entered idle
2014-05-13 11:22:58,849 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:22:58,849 mpDris2 DEBUG: Idle events: [{'changed': 'mixer'}]
2014-05-13 11:22:58,850 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:22:58,850 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:22:58,851 mpDris2 DEBUG: Entered idle
2014-05-13 11:23:03,297 mpDris2 DEBUG: Left idle
2014-05-13 11:23:03,297 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:23:03,298 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:23:03,299 mpDris2 DEBUG: Entered idle
2014-05-13 11:23:18,309 mpDris2 DEBUG: Left idle
2014-05-13 11:23:18,309 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:23:18,309 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:23:18,310 mpDris2 DEBUG: Entered idle
2014-05-13 11:23:33,309 mpDris2 DEBUG: Left idle
2014-05-13 11:23:33,309 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:23:33,310 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:23:33,311 mpDris2 DEBUG: Entered idle
2014-05-13 11:23:48,307 mpDris2 DEBUG: Left idle
2014-05-13 11:23:48,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:23:48,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:23:48,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:00,599 mpDris2 DEBUG: Left idle
2014-05-13 11:24:00,599 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:00,600 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:00,601 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:00,640 mpDris2 DEBUG: Left idle
2014-05-13 11:24:00,641 mpDris2 DEBUG: Sending command 'next' (was idle? True)
2014-05-13 11:24:00,694 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:00,735 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:24:00,735 mpDris2 DEBUG: Idle events: [{'changed': 'player'}]
2014-05-13 11:24:00,735 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:00,745 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:00,748 mpDris2 DEBUG: Updated property: Metadata = dbus.Dictionary({'xesam:album': 'The Brink', 'xesam:title': 'The End', 'xesam:trackNumber': 7, 'xesam:contentCreated': '2014', 'xesam:discNumber': 1, 'mpris:trackid': dbus.ObjectPath('/org/mpris/MediaPlayer2/Track/41'), 'mpris:length': dbus.Int64(241000000L), 'mpris:artUrl': 'file:///mnt/music/Jezabels, The/2014 - The Brink/cover.jpg', 'xesam:artist': ['The Jezabels'], 'xesam:url': 'file:///mnt/music/Jezabels, The/2014 - The Brink/07. The End.flac'}, signature=dbus.Signature('sv'))
2014-05-13 11:24:00,749 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:02,087 mpDris2 DEBUG: Left idle
2014-05-13 11:24:02,087 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:02,088 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:02,089 mpDris2 DEBUG: Expected pos 2.0, actual 1.37, diff -0.6299999999999999
2014-05-13 11:24:02,089 mpDris2 DEBUG: Old position was 0.0 at 1399944240 (2 seconds ago)
2014-05-13 11:24:02,089 mpDris2 DEBUG: Seeked to 1370000
2014-05-13 11:24:02,090 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:02,127 mpDris2 DEBUG: Left idle
2014-05-13 11:24:02,127 mpDris2 DEBUG: Sending command 'previous' (was idle? True)
2014-05-13 11:24:02,217 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:02,228 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:24:02,228 mpDris2 DEBUG: Idle events: [{'changed': 'player'}]
2014-05-13 11:24:02,228 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:02,230 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:02,234 mpDris2 DEBUG: Updated property: Metadata = dbus.Dictionary({'xesam:album': 'The Brink', 'xesam:title': 'No Country', 'xesam:trackNumber': 6, 'xesam:contentCreated': '2014', 'xesam:discNumber': 1, 'mpris:trackid': dbus.ObjectPath('/org/mpris/MediaPlayer2/Track/40'), 'mpris:length': dbus.Int64(274000000L), 'mpris:artUrl': 'file:///mnt/music/Jezabels, The/2014 - The Brink/cover.jpg', 'xesam:artist': ['The Jezabels'], 'xesam:url': 'file:///mnt/music/Jezabels, The/2014 - The Brink/06. No Country.flac'}, signature=dbus.Signature('sv'))
2014-05-13 11:24:02,235 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:03,295 mpDris2 DEBUG: Left idle
2014-05-13 11:24:03,296 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:03,296 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:03,297 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:18,307 mpDris2 DEBUG: Left idle
2014-05-13 11:24:18,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:18,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:18,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:33,307 mpDris2 DEBUG: Left idle
2014-05-13 11:24:33,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:33,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:33,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:24:48,307 mpDris2 DEBUG: Left idle
2014-05-13 11:24:48,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:24:48,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:24:48,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:25:03,307 mpDris2 DEBUG: Left idle
2014-05-13 11:25:03,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:25:03,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:25:03,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:25:18,307 mpDris2 DEBUG: Left idle
2014-05-13 11:25:18,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:25:18,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:25:18,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:25:33,307 mpDris2 DEBUG: Left idle
2014-05-13 11:25:33,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:25:33,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:25:33,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:25:48,307 mpDris2 DEBUG: Left idle
2014-05-13 11:25:48,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:25:48,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:25:48,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:26:03,307 mpDris2 DEBUG: Left idle
2014-05-13 11:26:03,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:26:03,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:26:03,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:26:18,307 mpDris2 DEBUG: Left idle
2014-05-13 11:26:18,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:26:18,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:26:18,309 mpDris2 DEBUG: Entered idle
2014-05-13 11:26:33,307 mpDris2 DEBUG: Left idle
2014-05-13 11:26:33,307 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:26:33,308 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:26:33,308 mpDris2 DEBUG: Entered idle
2014-05-13 11:26:35,549 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:26:35,549 mpDris2 DEBUG: Idle events: [{'changed': 'options'}]
2014-05-13 11:26:35,549 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:26:35,550 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:26:35,551 mpDris2 DEBUG: Updated property: LoopStatus = None
2014-05-13 11:26:35,551 mpDris2 DEBUG: Entered idle
2014-05-13 11:26:45,320 mpDris2 DEBUG: Socket event 1 on fd <__main__.MPDWrapper object at 0x2b59550>
2014-05-13 11:26:45,320 mpDris2 DEBUG: Idle events: [{'changed': 'options'}]
2014-05-13 11:26:45,320 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:26:45,321 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:26:45,322 mpDris2 DEBUG: Updated property: LoopStatus = None
2014-05-13 11:26:45,323 mpDris2 DEBUG: Entered idle
2014-05-13 11:26:48,297 mpDris2 DEBUG: Left idle
2014-05-13 11:26:48,297 mpDris2 DEBUG: Sending command 'currentsong' (was idle? False)
2014-05-13 11:26:48,298 mpDris2 DEBUG: Sending command 'status' (was idle? False)
2014-05-13 11:26:48,299 mpDris2 DEBUG: Entered idle
grawity commented 10 years ago

mpDris2 never grabs key events directly; org.gnome.SettingsDaemon.MediaKeys via DBus is the only interface it supports.

However, In GNOME 3.10, if no players have registered with gnome-settings-daemon for media keys, g-s-d will control them directly using MPRIS.

It seems that MATE's settings-daemon has a dedicated "mpris" plugin that works the same way. (Except MATE decided to hardcode supported players because NameOwnerChanged is too hard for them ಠ_ಠ)

So it's might be a problem with mate-settings-daemon; maybe it doesn't interact too well with the other keybindings you have? You could try to verify your own guess by removing the Openbox keybindings and checking if the problem still persists.