Skip to content

Instantly share code, notes, and snippets.

@onodes
Created August 10, 2010 18:42
Show Gist options
  • Save onodes/517759 to your computer and use it in GitHub Desktop.
Save onodes/517759 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'shell'
require 'sinatra'
get '/' do '
Balthazar music form
<form action="/" method="POST">
<input type="submit" name="submit" value="play"></form>
<form action="/" method="POST">
<input type="submit" name="submit" value="pause"></form>
<form action="/" method="POST">
<input type="submit" name="submit" value="next"></form>
<form action="/" method="POST">
<input type="submit" name="submit" value="previous"></form>
<form action="/" method="POST">
<input type="submit" name="submit" value="name"></form>
'
end
post '/' do
p command = params[:submit].to_s
sh = Shell.new
if command.include?("pause")
sh.system("rhythmbox-client","--pause")
"QUIT"
end
if command.include?("play")
sh.system("rhythmbox-client","--play")
"PLAY"
end
if command.include?("next")
sh.system("rhythmbox-client","--next")
"next"
end
if command.include?("previous")
sh.system("rhythmbox-client","--previous")
"previous"
end
if command.include?("name")
a = sh.system("rhythmbox-client","--print-playing")
"title #{a}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment