Skip to content

Instantly share code, notes, and snippets.

@practicingruby
Created February 26, 2011 23:13
Show Gist options
  • Save practicingruby/845725 to your computer and use it in GitHub Desktop.
Save practicingruby/845725 to your computer and use it in GitHub Desktop.
require "rubygems"
require "sinatra"
get "/next" do
tell_itunes "next track"
end
get "/previous" do
tell_itunes "previous track"
end
get "/pause" do
tell_itunes "pause"
end
get "/play" do
tell_itunes "play"
end
def tell_itunes(something)
%x{osascript -e 'tell application "itunes"' -e "#{something}" -e "end tell"}
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment