Announcements

Help Wizard

Step 1

NEXT STEP

FAQs

Please see below the most popular frequently asked questions.

Loading article...

Loading faqs...

VIEW ALL

Ongoing Issues

Please see below the current ongoing issues which are under investigation.

Loading issue...

Loading ongoing issues...

VIEW ALL

Basic controls via command line

Solved!

Basic controls via command line

Hello everyone,

 

I would like to be able to control some basic functions via command line like play/pause, could someone help?

 

Thanks!

Reply

Accepted Solutions
Marked as solution

Or you could just use dbus-send directly:

Play:

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

Pause:

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

Play/Pause toggle:

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

Previous:

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

Next:

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

Volume and seeking doesn't work via MPRIS because their MPRIS implementation is broken.

View solution in original post

5 Replies

Hi

 

https://gist.github.com/wandernauta/6800547

 

This has made a good work for me.

 

Hope it will help.

Marked as solution

Or you could just use dbus-send directly:

Play:

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

Pause:

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

Play/Pause toggle:

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

Previous:

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

Next:

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

Volume and seeking doesn't work via MPRIS because their MPRIS implementation is broken.

It doesn't work for me, when i type these commands, dbus sends this error:

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

Do you know how can i fix it?

On a standard install it should work, I have not tested them with the snap or flatpak. I know that the flatpak versions has issues. For example you can't raise it via dbus or MPRIS last time I checked. Spotify has to be running of course for any of the commands to work also.

I really wish they would open up their API. I don't see the logic of keeping the API closed and then releasing a garbage desktop app? Don't get me wrong, I love the spotify service (So much I actaully pay for it,lol!!!) But let's face it the desktop app is **bleep**... If they opened up the API it would take about a week and you'd have at least a couple awesome native Linux Spotify apps that they would not have to worry about.

Thanks this would be I guess a good complete solution! I was searching for a really basic and simple solution so I marked the dbus reply as solution but thanks for this hint as well!

Best

Eds

Suggested posts

Did you find this article helpful?