Initial Commit
authorJacob Casper <dev@jacobcasper.com>
Fri, 17 Jan 2020 19:18:07 +0000 (13:18 -0600)
committerJacob Casper <dev@jacobcasper.com>
Fri, 17 Jan 2020 19:25:47 +0000 (13:25 -0600)
README.md [new file with mode: 0644]
screenshot.png [new file with mode: 0644]
spot_track [new file with mode: 0755]

diff --git a/README.md b/README.md
new file mode 100644 (file)
index 0000000..ff9f891
--- /dev/null
+++ b/README.md
@@ -0,0 +1,16 @@
+# Intro
+
+Use Spotify's MPRIS2 D-Bus interface to pull information on your current track.
+
+![Screenshot Example in dwm status bar](screenshot.png)
+
+# Usage
+
+``` 
+$ ./spot_track
+Shells - Mo Lowda & The Humble
+```
+
+# Portability
+
+Relies on `dbus` but you probably have it included if your distro uses `systemd`.
diff --git a/screenshot.png b/screenshot.png
new file mode 100644 (file)
index 0000000..6a3e729
Binary files /dev/null and b/screenshot.png differ
diff --git a/spot_track b/spot_track
new file mode 100755 (executable)
index 0000000..26bb3e9
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+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' \
+| awk '/xesam:title/ {getline; title=substr($0, index($0, $3))} /xesam:artist/ {getline; getline; artist=substr($0, index($0, $2))} END { print title " - " artist}' \
+| tr -d '"'