Type in your question below and we'll check to see what answers we can find...
Loading article...
Submitting...
If you couldn't find any answers in the previous step then we need to post your question in the community and wait for someone to respond. You'll be notified when that happens.
Simply add some detail to your question and refine the title if needed, choose the relevant category, then post.
Before we can post your question we need you to quickly make an account (or sign in if you already have one).
Don't worry - it's quick and painless! Just click below, and once you're logged in we'll bring you right back here and post your question. We'll remember what you've already typed in so you won't have to do it again.
Plan
Premium
Device
ThinkPad T480
Operating System
Ubuntu 19.04
The Linux Spotify client has a bad habit of suddenly not publishing the artist and song title to Dbus sometimes. I have tried deleting caches and restarting Spotify a bunch, nothing helps. A full reboot seems to fix the issue most of the time.
An example of a broken state:
$ dbus-send --print-reply --session \ --dest=org.mpris.MediaPlayer2.spotify \ /org/mpris/MediaPlayer2 \ org.freedesktop.DBus.Properties.Get \ string:'org.mpris.MediaPlayer2.Player' \ string:'Metadata' method return time=1568710876.511629 sender=:1.1185 -> destination=:1.1190 serial=59 reply_serial=2 variant array [ dict entry( string "mpris:trackid" variant string "spotify:track:6RNdmlEXWrxdq0qUaBxcqR" ) dict entry( string "mpris:length" variant uint64 257024000 ) dict entry( string "mpris:artUrl" variant string "" ) dict entry( string "xesam:album" variant string "" ) dict entry( string "xesam:albumArtist" variant array [ string "" ] ) dict entry( string "xesam:artist" variant array [ string "" ] ) dict entry( string "xesam:autoRating" variant double 0 ) dict entry( string "xesam:discNumber" variant int32 0 ) dict entry( string "xesam:title" variant string "" ) dict entry( string "xesam:trackNumber" variant int32 0 ) dict entry( string "xesam:url" variant string "https://open.spotify.com/track/6RNdmlEXWrxdq0qUaBxcqR" ) ]
It's publishing other information, and that "xesam:url" is correct.
I've found this reproducable by playing music on another device through spotify connect.
I can play one song locally, use dbus to see all info just fine, then ask my google home to "play some music" and it'll just take over on the same song. Now Dbus only gives me mpris:trackid and xesam:url, all other information fields are empty.
I have noticed similar situations with my Google Home (or just playing it on my phone) but it's not consistent for me. I can sit a whole day controlling music playing on my Google Home from my Ubuntu laptop and it'll work fine and update the Dbus just fine. Other times it breaks and I can't get it working (sometimes not even after a reboot, clearing cache seems to help though).
Yeah, sadly it stopped being predictable for me after I wrote the post... I started writing a shell utility in ruby though that uses the web api to get song / artist when dbus only publishes song ID, I'll try to link it here when it's ready.
Here's another alternative: I recently wrote a program, that gets information from the web api and publishes them using MPRIS. It even supports the MPRIS features broken in the spotify client, like position and volume: https://github.com/freundTech/SpotPRIS2
Nice work freundTech! I was considering using the same solution for one of my projects, listen to Dbus and fall back to Web API if the Dbus is empty/missing data. The seek and volume information might make the Web API the winner though. I just wish I could use the nice Dbus/MPRIS solution... It's the canonical way to do these things in Linux, nudge nudge Spotify developers 😉
I know the Linux client is just a passion project and not officially supported, thanks for your hard work, it works REALLY well apart from Dbus weirdness!!
Hey there you, Yeah, you! 😁 Welcome - we're glad you joined the Spotify Community! While you here, let's have a fun game and get…