Created
August 10, 2010 18:42
-
-
Save onodes/517759 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
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