You are not logged in.

#1 2018-01-01 15:50:36

ExoDroiD
Member
Registered: 2018-01-01
Posts: 20

No org.mpris.MediaPlayer2 DBus service

Hello.

I'm using Spotify and trying to control it with MPRIS through DBus. Probably should note that I've never dealt with MPRIS nor DBus.

I started by trying this command (while Spotify was obviously running and playing):

dbus-send --print-reply --dest=org.mpris.MediaPlayer2 /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

Output is:

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.mpris.MediaPlayer2 was not provided by any .service files

After a bit of searches I concluded that

org.mpris.MediaPlayer2

is a  service that needs to be active in the session (please correct me if I'm wrong). So I ran

systemctl

and looked for anything related. Nothing.

I also tried to query DBus with:

dbus-send --session           \                          
  --dest=org.freedesktop.DBus \
  --type=method_call          \
  --print-reply               \
  /org/freedesktop/DBus       \
  org.freedesktop.DBus.ListNames

Nothing related here as well.

And here I am.

Thanks in advance.

Last edited by ExoDroiD (2018-01-01 15:53:53)

Offline

#2 2018-01-03 20:41:19

sekret
Member
Registered: 2013-07-22
Posts: 225

Re: No org.mpris.MediaPlayer2 DBus service

I use spopd for listening to music on spotify. For this I configured my media keys in the config file of dwm. Here's the entry for toggling playback:

"dbus-send", "--print-reply", "--dest=org.mpris.MediaPlayer2.spopd", "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2.Player.PlayPause"

which translates to this command

dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spopd /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

I see a difference between yours any my command line in the entry for --dest. I'm not sure what the spotify client (you use the official client, right?) is named here, but I guess you have to use

--dest=org.mpris.MediaPlayer2.spotify

The rest of your command looks fine, it's just what I have (which works!)

ExoDroiD wrote:

After a bit of searches I concluded that

org.mpris.MediaPlayer2

is a  service that needs to be active in the session (please correct me if I'm wrong). So I ran

systemctl

and looked for anything related. Nothing.

I didn't have to mess with any systemd related stuff, so I think you are on the wrong road here wink

edit: While I recommend for you to fix your command line and then use it, I still want to point out to you that there's a tool called playerctl (in [community]) which might make this task easier for you.

Last edited by sekret (2018-01-03 20:45:37)

Offline

#3 2018-01-04 13:39:34

ExoDroiD
Member
Registered: 2018-01-01
Posts: 20

Re: No org.mpris.MediaPlayer2 DBus service

sekret wrote:

I see a difference between yours any my command line in the entry for --dest. I'm not sure what the spotify client (you use the official client, right?) is named here, but I guess you have to use

--dest=org.mpris.MediaPlayer2.spotify

I tried using

--dest=org.mpris.MediaPlayer2.spotify

but forgot to mention it, even tried again after you suggested it just to make sure. The same error is yielded:

Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.mpris.MediaPlayer2.spotify was not provided by any .service files
sekret wrote:

edit: While I recommend for you to fix your command line and then use it, I still want to point out to you that there's a tool called playerctl (in [community]) which might make this task easier for you.

I know about this tool and have used it in the past, it's just that I wanted a less "dependant" way to control Spotify... (though I'm pretty sure that playerctl does the same thing I'm trying to do)
Anyway, as I've yet come to a solution, I'm gonna try playerctl and edit my response with the results.

EDIT:
Just as I expected, playerctl didn't help. When running

playerctl -l

which should list the running players, lists none (while Spotify was running of course).

Last edited by ExoDroiD (2018-01-04 15:33:44)

Offline

#4 2018-01-05 08:48:53

sekret
Member
Registered: 2013-07-22
Posts: 225

Re: No org.mpris.MediaPlayer2 DBus service

Ok then I'm out of ideas. I can only add, that the wiki covers those commands, see here.

Maybe a bug in the spotify client? I suggest you try another application with mpris support, just to see if it's not a dbus issue.

Offline

#5 2018-01-05 13:37:06

ExoDroiD
Member
Registered: 2018-01-01
Posts: 20

Re: No org.mpris.MediaPlayer2 DBus service

sekret wrote:

Ok then I'm out of ideas. I can only add, that the wiki covers those commands, see here.

Unfortunately, I went over this page more times than I'd admit.

sekret wrote:

Maybe a bug in the spotify client? I suggest you try another application with mpris support, just to see if it's not a dbus issue.

Will try that. I think I'm missing some of the information regarding the DBus service itself, for example:

  • Who should be responsible for activating this service? Is it the client?

  • If it's possible, could I activate it myself?


PS: Which client would you recommend testing it with?

Edit: Tried Clementine. Still no DBus service.

Last edited by ExoDroiD (2018-01-05 14:27:03)

Offline

#6 2018-01-05 14:03:19

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 7,063

Re: No org.mpris.MediaPlayer2 DBus service

The Dbus service should be initialized as part of the session startup by the systemd user session, you shouldn't have to activate it yourself, given your general setup is correct. What's the output of

systemctl --user status dbus

and FWIW the output of that dbus listing command you posted.

Offline

#7 2018-01-05 14:18:36

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 3,357

Re: No org.mpris.MediaPlayer2 DBus service

How are you starting your DE? If you use startx please post the contents of your ~/.xinitrc.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#8 2018-01-05 14:44:30

ExoDroiD
Member
Registered: 2018-01-01
Posts: 20

Re: No org.mpris.MediaPlayer2 DBus service

V1del wrote:

The Dbus service should be initialized as part of the session startup by the systemd user session, you shouldn't have to activate it yourself, given your general setup is correct. What's the output of

systemctl --user status dbus
$ systemctl --user status dbus
● dbus.service - D-Bus User Message Bus
   Loaded: loaded (/usr/lib/systemd/user/dbus.service; static; vendor preset: enabled)
   Active: active (running) since Fri 2018-01-05 16:13:09 IST; 37min ago
     Docs: man:dbus-daemon(1)
 Main PID: 640 (dbus-daemon)
   CGroup: /user.slice/user-1000.slice/user@1000.service/dbus.service
           ├─ 640 /usr/bin/dbus-daemon --session --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
           └─1559 /usr/lib/GConf/gconfd-2

Jan 05 16:13:09 dell systemd[579]: Started D-Bus User Message Bus.
Jan 05 16:13:09 dell dbus-daemon[640]: [session uid=1000 pid=640] Activating systemd to hand-off: service name='org.a11y.Bus' unit='at-spi-dbus-bus.service' requested by ':1.1' (uid=1000 pid=633 comm="nm-applet ")
Jan 05 16:13:09 dell dbus-daemon[640]: [session uid=1000 pid=640] Successfully activated service 'org.freedesktop.systemd1'
Jan 05 16:13:09 dell dbus-daemon[640]: [session uid=1000 pid=640] Successfully activated service 'org.a11y.Bus'
Jan 05 16:24:50 dell dbus-daemon[640]: [session uid=1000 pid=640] Activating service name='org.gnome.GConf' requested by ':1.12' (uid=1000 pid=1433 comm="/usr/lib/firefox/firefox ")
Jan 05 16:24:50 dell dbus-daemon[640]: [session uid=1000 pid=640] Successfully activated service 'org.gnome.GConf'
V1del wrote:

and FWIW the output of that dbus listing command you posted.

Did you mean this one?:

$ dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames
method return time=1515162666.148629 sender=org.freedesktop.DBus -> destination=:1.3 serial=3 reply_serial=2
   array [
      string "org.freedesktop.DBus"
      string ":1.3"
      string "org.gnome.Terminal"
      string ":1.1"
   ]
slithery wrote:

How are you starting your DE? If you use startx please post the contents of your ~/.xinitrc.

#!/bin/bash

exec i3

Last edited by ExoDroiD (2018-01-05 14:51:05)

Offline

#9 2018-01-05 14:55:56

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 3,357

Re: No org.mpris.MediaPlayer2 DBus service

Your ~/.xinitrc isn't launching the user session because it's missing vital sections...

https://wiki.archlinux.org/index.php/Xinit#xinitrc
See the second note.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#10 2018-01-05 15:09:30

ExoDroiD
Member
Registered: 2018-01-01
Posts: 20

Re: No org.mpris.MediaPlayer2 DBus service

slithery wrote:

Your ~/.xinitrc isn't launching the user session because it's missing vital sections...

https://wiki.archlinux.org/index.php/Xinit#xinitrc
See the second note.

I guess this if block should be after my

exec i3

That didn't help, still no MPRIS DBus interfaces. Tried with Spotify and with Clementine.

I assume adding this if block did do something as there're a bit more DBus interfaces...

Last edited by ExoDroiD (2018-01-05 15:10:47)

Offline

#11 2018-01-05 15:26:18

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 7,063

Re: No org.mpris.MediaPlayer2 DBus service

No it should be before your exec i3, all lines after the exec aren't executed anymore, since the process (i.e. i3)  replaces the bash shell that is parsing the script

Offline

#12 2018-01-05 15:34:17

ExoDroiD
Member
Registered: 2018-01-01
Posts: 20

Re: No org.mpris.MediaPlayer2 DBus service

V1del wrote:

No it should be before your exec i3, all lines after the exec aren't executed anymore, since the process (i.e. i3)  replaces the bash shell that is parsing the script

That makes sense, but I tried both and when the if block was after the exec there were more DBus interfaces. I'm gonna put it back to be before the exec.

Offline

#13 2018-01-06 20:27:43

sekret
Member
Registered: 2013-07-22
Posts: 225

Re: No org.mpris.MediaPlayer2 DBus service

slithery wrote:

Your ~/.xinitrc isn't launching the user session because it's missing vital sections...

https://wiki.archlinux.org/index.php/Xinit#xinitrc
See the second note.

This is interesting! I don't have this stuff in my .xinitrc, but still everything works!

#!/bin/sh
setxkbmap de
xset +fp /usr/share/fonts/local
xset fp rehash
xsetroot -cursor_name left_ptr
xrandr-default
dunst &
notify-send "$(khal list today)" &
conky | while read -r; do xsetroot -name "$REPLY"; done &
redshift &
exec dwm

Don't know if those xset* lines are still required, but I see no dbus stuff there. I know too little about dbus to understand this.

Just to be sure, this post is not intended to take over the thread, I'm just curious.

Offline

#14 2018-01-21 05:56:30

ExoDroiD
Member
Registered: 2018-01-01
Posts: 20

Re: No org.mpris.MediaPlayer2 DBus service

UPDATE:
I've now added Gnome Shell (alongside i3) and there's definately a D-Bus interface for Spotify:

$ dbus-send --session --dest=org.freedesktop.DBus --type=method_call --print-reply /org/freedesktop/DBus org.freedesktop.DBus.ListNames | grep spotify
      string "org.mpris.MediaPlayer2.spotify"

I'm still very interested about what causes this problem and how to fix it.
If there's any data I could provide to help identify the problem please let me know.

Offline

#15 2018-01-21 15:27:42

ajbibb
Member
Registered: 2012-02-12
Posts: 142

Re: No org.mpris.MediaPlayer2 DBus service

I think you may need to change this argument

--dest=org.mpris.MediaPlayer2

to this:

--dest=org.mpris.MediaPlayer2.spotify

Offline

Board footer

Powered by FluxBB