1 |
joko |
1.1 |
#!/usr/bin/perl -w |
2 |
|
|
# |
3 |
|
|
################################################## |
4 |
|
|
# |
5 |
|
|
# GiantDisc mp3 Jukebox, KeyPad Functions |
6 |
|
|
# |
7 |
|
|
# © 2000-2002, Rolf Brugger |
8 |
|
|
# Modified by Philipp Heckel |
9 |
|
|
# |
10 |
|
|
################################################## |
11 |
|
|
|
12 |
|
|
use strict; |
13 |
|
|
|
14 |
|
|
use IO::Socket; |
15 |
|
|
use Fcntl; |
16 |
|
|
|
17 |
|
|
|
18 |
|
|
use lib '/home/music/bin'; |
19 |
|
|
use gddb; |
20 |
|
|
use gdparams; |
21 |
|
|
use gdgentools; |
22 |
|
|
|
23 |
|
|
use DBI; |
24 |
|
|
|
25 |
|
|
|
26 |
|
|
################################################## |
27 |
|
|
### get Parameters |
28 |
|
|
if(scalar(@ARGV) != 4){ |
29 |
|
|
print("Syntax: gdkeypad.pl host-ip player-id audiochannel mode\n"); |
30 |
|
|
print(" mode can be 'play', 'pause', 'stop', 'next', 'prev', 'fastfwd' or 'rewind'\n"); |
31 |
|
|
exit(0); |
32 |
|
|
} |
33 |
|
|
|
34 |
|
|
my $dbhost = $ARGV[0]; |
35 |
|
|
my $playerid = $ARGV[1]; |
36 |
|
|
my $audiochannel = $ARGV[2]; |
37 |
|
|
my $mode = $ARGV[3]; |
38 |
|
|
|
39 |
|
|
$gdparms::dbhost = $dbhost; |
40 |
|
|
|
41 |
|
|
### open DB connection |
42 |
|
|
my $dbh = DBI->connect("DBI:mysql:GiantDisc:".$dbhost, "music", undef) |
43 |
|
|
or die "unable to connect to GiantDisc db"; |
44 |
|
|
|
45 |
|
|
### switch modes |
46 |
|
|
if ($mode eq 'play') { |
47 |
|
|
cmd_play($dbh,$playerid,$audiochannel); |
48 |
|
|
} |
49 |
|
|
elsif ($mode eq 'stop') { |
50 |
|
|
cmd_stop($dbh,$playerid,$audiochannel); |
51 |
|
|
} |
52 |
|
|
elsif ($mode eq 'pause') { |
53 |
|
|
cmd_pause($dbh,$playerid,$audiochannel); |
54 |
|
|
} |
55 |
|
|
elsif ($mode eq 'prev') { |
56 |
|
|
cmd_prev($dbh,$playerid,$audiochannel); |
57 |
|
|
} |
58 |
|
|
elsif ($mode eq 'next') { |
59 |
|
|
cmd_next($dbh,$playerid,$audiochannel); |
60 |
|
|
} |
61 |
|
|
elsif ($mode eq 'fastfwd') { |
62 |
|
|
cmd_fastfwd($dbh,$playerid,$audiochannel); |
63 |
|
|
} |
64 |
|
|
elsif ($mode eq 'rewind') { |
65 |
|
|
cmd_rewind($dbh,$playerid,$audiochannel); |
66 |
|
|
} |
67 |
|
|
|
68 |
|
|
#################################################################### |
69 |
|
|
### Keypad Functions |
70 |
|
|
|
71 |
|
|
sub cmd_stop{ |
72 |
|
|
gdgentools::pl_stop($dbh, $playerid, $audiochannel); |
73 |
|
|
} |
74 |
|
|
|
75 |
|
|
sub cmd_pause{ |
76 |
|
|
gdgentools::pl_pause($dbh, $playerid, $audiochannel); |
77 |
|
|
} |
78 |
|
|
|
79 |
|
|
sub cmd_play{ |
80 |
|
|
gdgentools::pl_play($dbh, $playerid, $audiochannel); |
81 |
|
|
} |
82 |
|
|
|
83 |
|
|
sub cmd_prev{ |
84 |
|
|
gdgentools::pl_prev($dbh, $playerid, $audiochannel); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
|
sub cmd_next{ |
88 |
|
|
gdgentools::pl_next($dbh, $playerid, $audiochannel); |
89 |
|
|
} |
90 |
|
|
|
91 |
|
|
sub cmd_fastfwd{ |
92 |
|
|
gdgentools::pl_ff($dbh, $playerid, $audiochannel); |
93 |
|
|
} |
94 |
|
|
|
95 |
|
|
sub cmd_rewind{ |
96 |
|
|
gdgentools::pl_rw($dbh, $playerid, $audiochannel); |
97 |
|
|
} |