Skip to content

Commit 15724ee

Browse files
authored
Merge pull request #1 from ioguix/master
Fix bug where "--player" arg was ignored
2 parents 23a2e54 + 38ded27 commit 15724ee

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

slimp3.pl

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -47,45 +47,50 @@ sub main {
4747

4848
} # end sub main
4949

50-
# Commands are extracted from the parameters p0, p1, p2, p3, & p4.
51-
# For example:
52-
# http://host/status.html?p0=stop
53-
# Both examples above execute a stop command, and sends an html status response
54-
#
55-
# Command parameters are query parameters named p0, p1, p2, p3 and p4
56-
# For example:
57-
# http://host/status.m3u?p0=playlist&p1=jump&p2=2
58-
# This example jumps to the second song in the playlist and sends a playlist as the response
59-
#
60-
# If there are multiple players, then they are specified by the player id
61-
# For example:
62-
# http://host/status.html?p0=mixer&p1=volume&p2=11&player=10.0.1.203:69
63-
#
50+
# Commands are extracted from the parameters p0, p1, p2, p3, & p4.
51+
# For example:
52+
# http://host/status.html?p0=stop
53+
# Both examples above execute a stop command, and sends an html status response
54+
#
55+
# Command parameters are query parameters named p0, p1, p2, p3 and p4
56+
# For example:
57+
# http://host/status.m3u?p0=playlist&p1=jump&p2=2
58+
# This example jumps to the second song in the playlist and sends a playlist as the response
59+
#
60+
# If there are multiple players, then they are specified by the player id
61+
# For example:
62+
# http://host/status.html?p0=mixer&p1=volume&p2=11&player=10.0.1.203:69
63+
#
6464
sub executeCommand {
6565
my ($httpaddr, $httpport, $player, $command, $p1, $p2, $p3, $p4) = @_;
6666
my $urlstring = undef;
6767
my $content = undef;
6868

69-
$urlstring = "http://$httpaddr:$httpport/status?p0=$command";
69+
$urlstring = "http://$httpaddr:$httpport/status.html?p0=$command";
7070

7171
if ( defined($p1) ) {
7272
$p1 =~s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
73-
$urlstring .= "&p1=" . $p1;
73+
$urlstring .= "&p1=" . $p1;
7474
}
7575

7676
if ( defined($p2) ) {
7777
$p2 =~s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
78-
$urlstring .= "&p2=" . $p2;
78+
$urlstring .= "&p2=" . $p2;
7979
}
8080

8181
if ( defined($p3) ) {
8282
$p3 =~s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
83-
$urlstring .= "&p3=" . $p3;
83+
$urlstring .= "&p3=" . $p3;
8484
}
8585

8686
if ( defined($p4) ) {
8787
$p4 =~s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
88-
$urlstring .= "&p4=" . $p4;
88+
$urlstring .= "&p4=" . $p4;
89+
}
90+
91+
if ( defined($player) ) {
92+
$player =~s/([^a-zA-Z0-9_\-.])/uc sprintf("%%%02x",ord($1))/eg;
93+
$urlstring .= "&player=" . $player;
8994
}
9095

9196
$urlstring .= "\n";
@@ -95,7 +100,6 @@ sub executeCommand {
95100

96101
print $urlstring, "\n";
97102

98-
99103
} # end sub executeCommand
100104

101105

0 commit comments

Comments
 (0)