Browse files

current rdio track

  • Loading branch information...
1 parent 88013a8 commit d5ae7df3cee655b2ad4794c7e8baacf72a85079d @pengwynn committed Dec 9, 2012
Showing with 27 additions and 0 deletions.
  1. +27 −0 wynn/libexec/wynn-rdio
View
27 wynn/libexec/wynn-rdio
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+# lifted from @sjl https://github.com/sjl/dotfiles/blob/master/bin/rdio-current-track-tmux
+
+RDIO_TRACK=$(osascript <<EOF
+if appIsRunning("Rdio") then
+ tell app "Rdio" to get the name of the current track
+end if
+
+on appIsRunning(appName)
+ tell app "System Events" to (name of processes) contains appName
+end appIsRunning
+EOF)
+
+if test "x$RDIO_TRACK" != "x"; then
+RDIO_ARTIST=$(osascript <<EOF
+if appIsRunning("Rdio") then
+ tell app "Rdio" to get the artist of the current track
+end if
+
+on appIsRunning(appName)
+ tell app "System Events" to (name of processes) contains appName
+end appIsRunning
+EOF)
+
+ echo $RDIO_TRACK '-' $RDIO_ARTIST
+fi

0 comments on commit d5ae7df

Please sign in to comment.