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