Created attachment 699363 [details, diff] Modernize GObject calls to GLib Controlling a running spotify instance doesn't work on my current default/linux/amd64/17.1/desktop/plasma/systemd installation. All calls to spotify-dbus.py that lead to DBus operations appear to fail: $ spotify-dbus.py --playpause /usr/lib/python-exec/python3.8/spotify-dbus.py:535: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead self.loop = GObject.MainLoop() Traceback (most recent call last): File "/usr/lib/python-exec/python3.8/spotify-dbus.py", line 667, in <module> s = Spotify() File "/usr/lib/python-exec/python3.8/spotify-dbus.py", line 636, in __init__ self.action_trigger('playpause') File "/usr/lib/python-exec/python3.8/spotify-dbus.py", line 211, in action_trigger self.player.PlayPause() File "/usr/lib/python3.8/site-packages/dbus/proxies.py", line 72, in __call__ return self._proxy_method(*args, **keywords) File "/usr/lib/python3.8/site-packages/dbus/proxies.py", line 141, in __call__ return self._connection.call_blocking(self._named_service, File "/usr/lib/python3.8/site-packages/dbus/connection.py", line 652, in call_blocking reply_message = self.send_message_with_reply_and_block( dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.MediaPlayer2” on object at path / or: $ spotify-dbus.py spotify:track:0eHxqgbpr2ptXQtw8Ab3ve /usr/lib/python-exec/python3.8/spotify-dbus.py:535: PyGIDeprecationWarning: GObject.MainLoop is deprecated; use GLib.MainLoop instead self.loop = GObject.MainLoop() Traceback (most recent call last): File "/usr/lib/python-exec/python3.8/spotify-dbus.py", line 667, in <module> s = Spotify() File "/usr/lib/python-exec/python3.8/spotify-dbus.py", line 616, in __init__ self.action_trigger('uri', sys.argv[1]) File "/usr/lib/python-exec/python3.8/spotify-dbus.py", line 231, in action_trigger window._openLink(param) File "/usr/lib/python3.8/site-packages/dbus/proxies.py", line 72, in __call__ return self._proxy_method(*args, **keywords) File "/usr/lib/python3.8/site-packages/dbus/proxies.py", line 141, in __call__ return self._connection.call_blocking(self._named_service, File "/usr/lib/python3.8/site-packages/dbus/connection.py", line 652, in call_blocking reply_message = self.send_message_with_reply_and_block( dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such interface “local.sp.SpotifyApplicationLinux” on object at path /MainWindow Replacing the deprecated GObject interfaces by the suggested GLib ones (see patch attached) silences the warnings, but the problem remains exactly the same. I'm happy to look into this further myself, but would greatly appreciate any pointers on how to understand and test "all that DBus stuff". Is there an introspection tool available? Something convenient to monitor and test arbitrary calls and interfaces?
Forgot to mention: gnome-extra/gnome-integration-spotify-20140907-r1 gets pulled in by just installing the current ~amd64 release of media-sound/spotify-1.1.55, and the aforementioned spotify-dbus.py script appears to get installed as the system handler for both the application icon and the xdg-open etc stuff.
OK, I dug a little deeper. Seems that the dbus interfaces used to successfully talk to the spotify desktop client have changed, through sheer luck of very little guesswork I made the relevant change which allows the following actions to work successfully. Patch attached. - opening of URIs - playpause - next - prev The following actions do NOT work as expected: - play - stop - quit - info And there's window handling actions that look like work in progress in the first place, those also do not work as they currently are: - show - hide - toggle Also, there was a command line parsing bug that would lead to the playpause action always being triggered when parsing got to that point, seperate patch attached.
Created attachment 699372 [details, diff] Use new/correct identifier for mpris DBus interface
Created attachment 699375 [details, diff] Fix command line parsing
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2f8d66d7600d62428c4b0e762c4732590607b2ef commit 2f8d66d7600d62428c4b0e762c4732590607b2ef Author: Matthew Thode <prometheanfire@gentoo.org> AuthorDate: 2021-04-20 20:17:44 +0000 Commit: Matthew Thode <prometheanfire@gentoo.org> CommitDate: 2021-04-20 20:17:57 +0000 gnome-extra/gnome-integration-spotify: fix dbus integration Closes: https://bugs.gentoo.org/782433 Package-Manager: Portage-3.0.17, Repoman-3.0.2 RepoMan-Options: --force Signed-off-by: Matthew Thode <prometheanfire@gentoo.org> ...-integration-spotify-command-line-parsing.patch | 11 ++++++ ...ome-integration-spotify-correct-interface.patch | 23 +++++++++++++ .../files/gnome-integration-spotify-use-glib.patch | 40 ++++++++++++++++++++++ ...> gnome-integration-spotify-20140907-r2.ebuild} | 8 ++++- 4 files changed, 81 insertions(+), 1 deletion(-)