aboutsummaryrefslogtreecommitdiff
path: root/scripts/media_print_spotify_info.sh
blob: 3171023a2df334fe74eb29095c33d6aabf728d1f (plain)
1
2
3
4
5
6
7
8
9
#!/bin/bash

metadata=$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata')
                                                                                
artist=$(echo "$metadata" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d  '"' -f 1 | egrep -v ^$)
                                                                                        
title=$(echo "$metadata" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1| egrep -v ^$)

echo $artist - $title