Skip to content

Instantly share code, notes, and snippets.

@bensonk
Created October 22, 2012 23:08
Show Gist options
  • Save bensonk/3935349 to your computer and use it in GitHub Desktop.
Save bensonk/3935349 to your computer and use it in GitHub Desktop.
require 'sinatra'
get "/" do
mpc_output = IO.popen("mpc").readlines.join("<br/>")
"<html><body>" +
" <h3>#{mpc_output}</h3>" +
' <p><a href="prev">prev</a> <a href="/toggle">play/pause</a> <a href="/next">next</a></p>' +
"</body></html>"
end
get '/prev' do
system "mpc prev"
redirect "/"
end
get '/next' do
system "mpc next"
redirect "/"
end
get '/toggle' do
system 'mpc toggle'
redirect "/"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment