Skip to content

Instantly share code, notes, and snippets.

@ymek
Created August 12, 2010 17:05
Show Gist options
  • Save ymek/521290 to your computer and use it in GitHub Desktop.
Save ymek/521290 to your computer and use it in GitHub Desktop.
#!/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