To get the current song being played in spotify (using DBus), I use the following command:
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'
Now, the output of the command below is like: (stripped down for clarity)
variant array [
dict entry(
string "xesam:artist"
variant array [
string "The Black Keys"
]
)
dict entry(
string "xesam:title"
variant string "Give Your Heart Away"
)
]
The output is a bit long & I want to parse specific values from it like title, artist etc.
Googling said that variant a popular datatype used in Component Object Model so I get there is a better way than using sed/awk to get the values. So, how do I go about doing this?
dbusmodule in python.