From: Jacob Casper Date: Fri, 17 Jan 2020 19:18:07 +0000 (-0600) Subject: Initial Commit X-Git-Url: https://git.jacobcasper.com/?p=spot-check-nix.git;a=commitdiff_plain;h=5b73abf97097f945add4b14dd0418c088cc409f8 Initial Commit --- 5b73abf97097f945add4b14dd0418c088cc409f8 diff --git a/README.md b/README.md new file mode 100644 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 index 0000000..6a3e729 Binary files /dev/null and b/screenshot.png differ diff --git a/spot_track b/spot_track new file mode 100755 index 0000000..26bb3e9 --- /dev/null +++ b/spot_track @@ -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 '"'