2 ############################################################################
3 # soepkiptng (c) copyright 2000 Eric Lammerts <eric@lammerts.org>.
5 ############################################################################
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License, version 2, as
8 # published by the Free Software Foundation.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # A copy of the GNU General Public License is available on the World Wide Web
16 # at `http://www.gnu.org/copyleft/gpl.html'. You can also obtain it by
17 # writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 # Boston, MA 02111-1307, USA.
19 ############################################################################
27 # find program directory
30 my $l = readlink or die "readlink $_: $!\n";
31 if($l =~ m
|^/|) { $_ = $l; } else { s|[^/]*$|/$l|; }
34 my $progdir = abs_path
($1);
36 require "$progdir/soepkiptng.lib";
40 read_configfile
(\
%conf, $opt_c);
42 while(!defined($sock = opensocket
())) {
48 print "space=pause n=next\n";
53 $sock->print("status\n");
56 while(!defined($sock = opensocket
())) {
65 printf " %-74s\r", songinfo
();
70 printf "\r%2d:%02d\r", $t / 60, $t % 60;
73 # wait for 0.1s or until a key is pressed
74 while($_ = lc ReadKey
0.1) {
78 $sock->print("pausetoggle\n");
87 open F
, $conf{statusfile
} or return "unknown";
88 <F
>; <F
>; <F
>; <F
>; <F
>; <F
>; <F
>; <F
>;
89 chop (($ar, $t, $al, $tr, $len) = <F
>);
92 return sprintf "/%d:%02d %.25s - %.25s (%s%.20s)",
94 $ar, $t, $tr?
"[$tr] ":"", $al;
103 open F
, $conf{statusfile
} or do {
104 warn "$conf{statusfile}: $!\n";
108 chop(my $host = <F
>);
111 $s = IO
::Socket
::INET
->new("$host:2222") and last;
112 warn "$host:2222: $!\n";
113 sleep $sleeptime / 1000;
114 $sleeptime = $sleeptime * 11 / 10 unless $sleeptime > 60000;
117 $response = <$s>; #discard greeting