Help Wizard

Step 1

NEXT STEP

[BUG] Spotify Linux version on KDE

Solved!

[BUG] Spotify Linux version on KDE

I am not able to control spotify using the media keys. Also it fails to syncronize with the Media Player interface of KDE (plasmoid etc).

 

I am getting this error in the console log:

 

04:46:41.215 W [mpris.cpp:137 ] Unrecognized or unimplemented MPRIS MediaPlayer2 method 'GetAll'

 

I assume that this is the same as here: https://bugs.kde.org/show_bug.cgi?id=351852

 

I appreciate any help.

 

 

Reply

Accepted Solutions
Marked as solution

Hi cHagHi,

 

I came up with this script to check if there is any mpris player running. If there is any, then all commands go to the mpris player, otherwise the script pushes everything to spotify.

 

https://github.com/GustavoKatel/spotify-with-mpris

 

You may need to install this package: http://manpages.ubuntu.com/manpages/oneiric/man1/mpris-remote.1.html

 

You just have to bind the media keys to the script using the args to switch the commands.

 

Example:

$ spotify-keys.sh PlayPause

$ spotify-keys.sh Stop

$ spotify-keys.sh Next

$ spotify-keys.sh Previous

 

I only tested with clementine. It would be nice to have some more players tested.

 

Let me know if it works with you.

View solution in original post

Marked as solution

This should now be fixed in the testing channel with the release of 1.0.28.

 

View solution in original post

17 Replies

Yes, it's a known issue. Unfortunately the current beta's MPRIS2 implementation is (very) limited.

 

See this thread: https://community.spotify.com/t5/Help-Desktop-Linux-Windows-Web/Linux-Spotify-DBus-MPRIS2-support-no...

Thanks for the reply.

 

I understand. I managed to bind the media keys to their respective dbus methods, but it'd be really neat to see spotify fully integrated.


@gustavokatel wrote:

Thanks for the reply.

 

I understand. I managed to bind the media keys to their respective dbus methods, but it'd be really neat to see spotify fully integrated.


Cool!

 

Would you mind sharing how did you do it? Do the media keys still work with other media players / programs with your solution? I tried a couple of times to come up with some hack, but every time they either didn't work or ended up tying the media keys exclusively to Spotify, so they would not longer work with other players (f.i., Amarok, VLC, etc.)

Marked as solution

Hi cHagHi,

 

I came up with this script to check if there is any mpris player running. If there is any, then all commands go to the mpris player, otherwise the script pushes everything to spotify.

 

https://github.com/GustavoKatel/spotify-with-mpris

 

You may need to install this package: http://manpages.ubuntu.com/manpages/oneiric/man1/mpris-remote.1.html

 

You just have to bind the media keys to the script using the args to switch the commands.

 

Example:

$ spotify-keys.sh PlayPause

$ spotify-keys.sh Stop

$ spotify-keys.sh Next

$ spotify-keys.sh Previous

 

I only tested with clementine. It would be nice to have some more players tested.

 

Let me know if it works with you.

Thanks Gustavo! It worked like a charm.

 

Cool! Which player did you use?

I tested it with Amarok and VLC.

 

Amarok behaves as expected (if it's running, it gets detected as an MPRIS player and the media events are pushed to it instead of Spotify).

 

VLC does not work, but I'm 99% sure it has tu do with VLC and not the script. It's just that VLC is not recognized as an MPRIS player by mpris-remote, and to tell you the truth, I'm not sure if the media keys worked with it before either. I'll have to investigate that a little bit more.

 

But Amarok is the media player I use the most (after Spotify), so it's more than enough 🙂

 

Cheers!

 

 

 

Awesome!

Hi gustavokatel,

 

That worked perfectly, thank you!

update to 1.0.27.71.g0a26e3b2 changed to error message to:

 

09:42:22.697 I [mpris.cpp:304 ] Received MPRIS MediaPlayer2.Player 'Get' request, but no metadata is available

Same here 😞

 

Supposedly the 1.0.27 version fixed several MPRIS2 issues, but it's not working for me either. I'm seeing the same error when I start Spotify from the command line (although I don't know if the error is related), and the sound applet in KDE still doesn't "see" Spotify when it's running.

 

21:49:16.235 I [mpris.cpp:304                   ] Received MPRIS MediaPlayer2.Player 'Get' request, but no metadata is available

mpris-remote also fails to detect Spotify as a MPRIS-compliant player:

 

$ mpris-remote identity                   
No MPRIS-compliant player found running.

I'm running Spotify version 1.0.27.71.g0a26e3b2-9:

 

$ apt-cache policy spotify-client
spotify-client:
  Installed: 1:1.0.27.71.g0a26e3b2-9
  Candidate: 1:1.0.27.71.g0a26e3b2-9
  Version table:
 *** 1:1.0.27.71.g0a26e3b2-9 0
        500 http://repository.spotify.com/ testing/non-free amd64 Packages
        100 /var/lib/dpkg/status
     1:1.0.25.127.g58007b4c-22 0
        500 http://repository.spotify.com/ stable/non-free amd64 Packages

But on several threads here in the forums other linux users are reporting that with this version MPRIS2 is working. I really don't understand.

 

 

I never checked mpris-remote or that the sound applet in KDE worked. I only verified with Unity in different versions of Ubuntu and a few plugins in Gnome. I can confirm that mpris-remote is not finding Spotify either, but it also can't find Rhythmbox. mpris-remote does find amarok though.

 

The error message that you are seeing:

 

Received MPRIS MediaPlayer2.Player 'Get' request, but no metadata is available.

is just because the sound applet does a Get request to get metadata on the current track directly when it finds the dbus connection before the client has started properly. You will see this error message in Unity where the media controls are working.

 

 

I noticed that when I disabled the media control widget and didn't get the error when I started Spotify.

 

I can control spotify with my custom dbus shortcuts and Kdeconnect can control Spotify (pause playback when I get a call or remote control).

 

qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play

qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause

 

But the Plasma Media Controls can't control.

 

I unloaded the Media Control widget and reloaded it and got the following error in my .xsession-errors

 

plasma.engine.mpris2: Found MPRIS2 service "org.mpris.MediaPlayer2.spotify"
plasma.engine.mpris2: Haven't already seen "org.mpris.MediaPlayer2.spotify"
plasma.engine.mpris2: "org.mpris.MediaPlayer2.spotify" does not implement org.freedesktop.DBus.Properties correctly
plasma.engine.mpris2: Error message was "org.freedesktop.DBus.Error.InvalidSignature" "Unexpected reply signature: got \"v\", expected \"a{sv}\""
plasma.engine.mpris2: Failed to find working MPRIS2 interface for "org.mpris.MediaPlayer2.spotify"

 

I made further tests and this is what I found:

 

Plasma Media Control works with VLC and the first difference I found between VLC and Spotify Mpris2 dbus interface was following:

 

VLC:
qdbus --literal org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.GetAll org.mpris.MediaPlayer2
[Argument: a{sv} {"Identity" = [Variant(QString): "VLC media player"], "DesktopEntry" = [Variant(QString): "vlc"], "SupportedMimeTypes" = [Variant(QStringList): {"audio/mpeg", "audio/x-mpeg", "video/mpeg", "video/x-mpeg", "video/mpeg-system", "video/x-mpeg-system", "video/mp4", "audio/mp4", "video/x-msvideo", "video/quicktime", "application/ogg", "application/x-ogg", "video/x-ms-asf", "video/x-ms-asf-plugin", "application/x-mplayer2", "video/x-ms-wmv", "video/x-google-vlc-plugin", "audio/wav", "audio/x-wav", "audio/3gpp", "video/3gpp", "audio/3gpp2", "video/3gpp2", "video/divx", "video/flv", "video/x-flv", "video/x-matroska", "audio/x-matroska", "application/xspf+xml"}], "SupportedUriSchemes" = [Variant(QStringList): {"file", "http", "https", "rtsp", "realrtsp", "pnm", "ftp", "mtp", "smb", "mms", "mmsu", "mmst", "mmsh", "unsv", "itpc", "icyx", "rtmp", "rtp", "dccp", "dvd", "vcd", "vcdx"}], "HasTrackList" = [Variant(bool): false], "CanQuit" = [Variant(bool): true], "CanSetFullscreen" = [Variant(bool): false], "Fullscreen" = [Variant(bool): false], "CanRaise" = [Variant(bool): false]}]

Spotify:
qdbus --literal org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.GetAll org.mpris.MediaPlayer2
[Variant: [Argument: a{sv} {"CanQuit" = [Variant(bool): false], "CanRaise" = [Variant(bool): false], "DesktopEntry" = [Variant(QString): "spotify"], "HasTrackList" = [Variant(bool): false], "Identity" = [Variant(QString): "Spotify"], "SupportedMimeTypes" = [Variant(QStringList): {}], "SupportedUriSchemes" = [Variant(QStringList): {"spotify"}]}]]

VLC responses with [Argument: a{sv} {... and Spotify with [Variant: [Argument: a{sv} {...


@durin wrote:

VLC responses with [Argument: a{sv} {... and Spotify with [Variant: [Argument: a{sv} {...


Thanks. That is very likely the error.

 

I wonder why most other tools accept Variant for GetAll.

 

I don't why others work but if I read the D-Bus specification correctly org.freedesktop.DBus.Properties.GetAll is expected to return in the format of DICT<STRING,VARIANT> and not only V

 

https://dbus.freedesktop.org/doc/dbus-specification.html#standard-interfaces-properties

Marked as solution

This should now be fixed in the testing channel with the release of 1.0.28.

 

It is fixed with the recent release 1.0.28! Thank you very much!

Suggested posts