use -V0 --vbr-new by default; add -O option
[soepkiptng.git] / soepkiptng_picture
blob96b4f722e974304e011fcd66a96f55941c363c9d
1 #!/usr/bin/perl
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 ############################################################################
20 use Cwd 'abs_path';
21 use Getopt::Std;
23 # find program directory
24 $_ = $0;
25 while(-l) {
26 my $l = readlink or die "readlink $_: $!\n";
27 if($l =~ m|^/|) { $_ = $l; } else { s|[^/]*$|/$l|; }
29 m|(.*)/|;
30 my $progdir = abs_path($1);
32 require "$progdir/soepkiptng.lib";
34 getopts('c:');
36 read_configfile(\%conf, $opt_c);
38 $SIG{'HUP'} = sub {
39 exec $0;
40 die;
43 for(;;) {
44 my $newmtime = (stat $conf{statusfile})[9];
46 if(!$pic || -e $pic) {
47 if($newmtime == $mtime) {
48 sleep 1;
49 next;
53 open F, $conf{statusfile} or next;
54 $mtime = $newmtime;
56 my ($nowplaying, $filename);
57 chop($nowplaying = <F>);
58 chop($filename = <F>);
59 <F>;
60 $playerpid = 0 + <F>;
61 chop ((undef, undef, undef, undef,
62 $now_playing->{artist},
63 $now_playing->{title},
64 $now_playing->{album},
65 $now_playing->{track}) = <F>);
66 close F;
68 $nowplaying > 0 or next;
70 # get dir
71 $filename =~ s|/*[^/]+$||;
72 $filename =~ s|.*/|$progdir/pictures/|;
74 $pic = undef;
75 foreach(qw/gif jpg jpeg/) {
76 if(-e "$filename.$_") {
77 $pic = "$filename.$_";
78 last;
82 if($pic) {
83 system qw/xloadimage -onroot -fullscreen -border black/, $pic;
84 } else {
85 warn "$filename not found\n";
86 if($conf{picture_bg}) {
87 system qw/xloadimage -onroot -fullscreen -border black/,
88 $conf{picture_bg};
89 } else {
90 system "xsetroot -solid black";