aboutsummaryrefslogtreecommitdiff
path: root/scripts/spotify-artist-title.sh
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2015-11-25 20:17:15 +0100
committerFlorian Fischer <florian.fl.fischer@fau.de>2015-11-27 02:44:53 +0100
commite02542fca8dfe25bc22346b55b35d2a6cbc0c35c (patch)
tree82b66ccf80fa72371df9fc36ed4fa94bb2fddf63 /scripts/spotify-artist-title.sh
parent2a9bfb8a3c90031cea661b1de69caca885b21530 (diff)
downloaddotfiles-e02542fca8dfe25bc22346b55b35d2a6cbc0c35c.tar.gz
dotfiles-e02542fca8dfe25bc22346b55b35d2a6cbc0c35c.zip
rework media buttons control to function with spotify
also remove bash wrapper for fish scripts and just use bash scripts
Diffstat (limited to 'scripts/spotify-artist-title.sh')
-rw-r--r--scripts/spotify-artist-title.sh14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/spotify-artist-title.sh b/scripts/spotify-artist-title.sh
new file mode 100644
index 0000000..62494b8
--- /dev/null
+++ b/scripts/spotify-artist-title.sh
@@ -0,0 +1,14 @@
+#!/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')
+
+if [[ $metadata == *"spotify:ad"* ]]
+then
+ echo "ad :/"
+else
+ 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
+fi