Permalink
Browse files

changed method set_value (get value from url)

  • Loading branch information...
1 parent 4b27a35 commit 7c5679a93e9eb3bcac7501a1d795d656ac4abebf @msoap committed Feb 3, 2013
Showing with 6 additions and 7 deletions.
  1. +3 −4 mojolicious-radio-box.pl
  2. +1 −2 src/radio-box-client.coffee
  3. +2 −1 src/routers.pm
View
@@ -355,7 +355,8 @@ sub _cmus_parse_info {
return $self->render_json({status => 'ok', info => cmus_get_music()});
};
-post '/set_volume' => sub {
+# curl -s -d '' 'http://localhost:8080/set_volume/20'
+post '/set_volume/:volume' => [volume => qr/\d+/] => sub {
my $self = shift;
my $volume = $self->param("volume");
@@ -693,9 +694,7 @@ sub _cmus_parse_info {
if ((new_volume != null) && new_volume !== App.volume) {
App.volume = new_volume;
$("#volume_slider").val(new_volume);
- return $.post('/set_volume', {
- volume: new_volume
- });
+ return $.post('/set_volume/' + new_volume);
}
}, 200);
}
@@ -184,8 +184,7 @@ window.App =
if new_volume? && new_volume != App.volume
App.volume = new_volume
$("#volume_slider").val(new_volume)
- $.post '/set_volume'
- volume: new_volume
+ $.post '/set_volume/' + new_volume
200
)
# .............................................................................
View
@@ -46,7 +46,8 @@ get '/get_music' => sub {
return $self->render_json({status => 'ok', info => cmus_get_music()});
};
-post '/set_volume' => sub {
+# curl -s -d '' 'http://localhost:8080/set_volume/20'
+post '/set_volume/:volume' => [volume => qr/\d+/] => sub {
my $self = shift;
my $volume = $self->param("volume");

0 comments on commit 7c5679a

Please sign in to comment.