Permalink
Browse files

Tighter access to player methods

  • Loading branch information...
1 parent e9e1c6d commit fa0c421da5c5dafd37daff325b18266d292c180e @sunny committed May 20, 2011
Showing with 9 additions and 2 deletions.
  1. +9 −2 sonice.rb
View
11 sonice.rb
@@ -40,8 +40,15 @@ def artist_image(artist)
end
put '/player' do
- return unless settings.controls || settings.voting
- params.each { |k, v| $player.send(k) if $player.respond_to?(k) }
+ if settings.voting
+ $player.vote if params['vote']
+ end
+
+ if settings.controls
+ methods = %w(playpause prev next voldown volup) & params.keys
+ methods.each { |method| $player.send(method) }
+ end
+
if !request.xhr?
redirect '/'
end

0 comments on commit fa0c421

Please sign in to comment.