Created
August 12, 2010 17:05
-
-
Save ymek/521290 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
Control_File = '$HOME/.appdata/GroovesharkDesktop.7F9BF17D6D9CB2159C78A6A6AB076EA0B1E0497C.1/Local\ Store/shortcutAction.txt' | |
if File.directory? "$HOME/documents" | |
Current_Song = '$HOME/documents/Grooveshark/currentSong.txt' | |
else if File.directory? "$HOME/Documents" | |
Current_Song = '$HOME/Documents/Grooveshark/currentSong.txt' | |
else | |
# couldn't find the current status. exit gracefully so we don't crash the WM or anything | |
exit 1 | |
end | |
if %x(cat #{Current_Song} | awk -F "\t" '{ print $4 }') =~ /play/ | |
new_state = 'pause' | |
else | |
new_state = 'play' | |
end | |
%x(echo "#{new_state}" >> #{Control_File}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment