Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 782433 - gnome-extra/gnome-integration-spotify-20140907-r1 - spotify-dbus.py - org.freedesktop.DBus.Error.UnknownMethod: No such interface
Summary: gnome-extra/gnome-integration-spotify-20140907-r1 - spotify-dbus.py - org.fre...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Matthew Thode ( prometheanfire )
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2021-04-12 09:26 UTC by Joe Breuer
Modified: 2021-04-20 20:18 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Modernize GObject calls to GLib (spotify-dbus_GLib.patch,1.18 KB, patch)
2021-04-12 09:26 UTC, Joe Breuer
Details | Diff
Use new/correct identifier for mpris DBus interface (spotify-dbus_mpris.patch,798 bytes, patch)
2021-04-12 10:15 UTC, Joe Breuer
Details | Diff
Fix command line parsing (spotify-dbus_actionParsing.patch,358 bytes, patch)
2021-04-12 10:16 UTC, Joe Breuer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joe Breuer 2021-04-12 09:26:53 UTC
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?
Comment 1 Joe Breuer 2021-04-12 09:28:28 UTC
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.
Comment 2 Joe Breuer 2021-04-12 10:14:50 UTC
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.
Comment 3 Joe Breuer 2021-04-12 10:15:28 UTC
Created attachment 699372 [details, diff]
Use new/correct identifier for mpris DBus interface
Comment 4 Joe Breuer 2021-04-12 10:16:35 UTC
Created attachment 699375 [details, diff]
Fix command line parsing
Comment 5 Larry the Git Cow gentoo-dev 2021-04-20 20:18:02 UTC
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(-)