2 ############################################################################
3 # soepkiptng (c) copyright 2000 Eric Lammerts <eric@lammerts.org>.
4 ############################################################################
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License, version 2, as
7 # published by the Free Software Foundation.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # A copy of the GNU General Public License is available on the World Wide Web
15 # at `http://www.gnu.org/copyleft/gpl.html'. You can also obtain it by
16 # writing to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 # Boston, MA 02111-1307, USA.
18 ############################################################################
25 use POSIX
":sys_wait_h";
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 $dbh = connect_to_db
(\
%conf);
45 open STDOUT
, ">/dev/null";
47 while(waitpid(-1,WNOHANG
) > 0) {
52 while((stat $conf{statusfile
})[9] == $mtime) { sleep 1; }
54 if($pid) { kill 9, $pid; wait; }
55 print STDERR
"\n"x100
;
56 open F
, $conf{statusfile
} or next;
60 ($lyrics, $ar, $ti, $al, $tr) = $dbh->selectrow_array(
61 "SELECT lyrics.lyrics, artist.name, song.title, album.name, song.track " .
63 "LEFT JOIN album ON album.id=song.album_id " .
64 "LEFT JOIN artist ON artist.id=song.artist_id " .
65 "LEFT JOIN lyrics ON lyrics.id=song.id " .
70 if(($pid = fork) == 0) {
71 open STDOUT
, ">/dev/tty";
76 $t = "$ar - $ti ($al [$tr])";
78 print "-" x
length($t);
79 print "\n\n$lyrics\n";