Help Wizard

Step 1

NEXT STEP

DBus OpenUri not playing

Solved!

DBus OpenUri not playing

Hi:

 

I am using spotify1.0.17.75.g8f111100 on Arch Linux. Whenever I try to play an album via DBus, for instance

 

dbus-send  --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri "string:spotify:album:4sb0eMpDn3upAFfyi4q2rw"

It correctly opens the album, but does not start playing it. I remember a previous version of the linux client supported this, is it a regression?

Reply

Accepted Solutions
Marked as solution

Hey @pschorf,

 

 

Sorry, I was unable to test the script at first place. 🙂

 

Here is a workaround using the deprecated

uri=spotify:album:4sb0eMpDn3upAFfyi4q2rw # We are going to use this variable to access the metadata for the album.
song=$(curl -G "http://ws.spotify.com/lookup/1/?uri=$uri&extras=track" | grep -E -o "spotify:track:[a-zA-Z0-9]+" -m 1) # Get the first track of the Album. We are going to use this variable in next line.
dbus-send  --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause && dbus-send  --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri "string:$song" # Pause the player and the play the first song of the album

 

For long term, you can check the Web API and update the curl line.

Hope this help 🙂

 

 

View solution in original post

4 Replies

Hey @pschorf and welcome to Spotify Community, 

 

I am not sure what happened with the autoplay option, but you can execute PlayPause option right after and it will act the same:

 

dbus-send  --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri "string:spotify:album:4sb0eMpDn3upAFfyi4q2rw" && dbus-send  --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

That actually plays/pauses whatever I had open before, not the new content.

Marked as solution

Hey @pschorf,

 

 

Sorry, I was unable to test the script at first place. 🙂

 

Here is a workaround using the deprecated

uri=spotify:album:4sb0eMpDn3upAFfyi4q2rw # We are going to use this variable to access the metadata for the album.
song=$(curl -G "http://ws.spotify.com/lookup/1/?uri=$uri&extras=track" | grep -E -o "spotify:track:[a-zA-Z0-9]+" -m 1) # Get the first track of the Album. We are going to use this variable in next line.
dbus-send  --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause && dbus-send  --print-reply --session --type=method_call --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.OpenUri "string:$song" # Pause the player and the play the first song of the album

 

For long term, you can check the Web API and update the curl line.

Hope this help 🙂

 

 

That works! Sorry, I was away from my linux machine for a bit so I couldn't confirm. Thanks very much.

Suggested posts