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 $dbh = DBI
->connect("DBI:$conf{db_type}:$conf{db_name}:$conf{db_host}",
43 $conf{db_user
}, $conf{db_pass
}) or die "can't connect to database";
45 $files = $dbh->selectcol_arrayref("SELECT filename FROM song WHERE present AND filesize IS NULL AND filename LIKE '/%'");
48 defined($size = -s
$_) or next;
49 $dbh->do("UPDATE song SET filesize=? WHERE filename=?", undef, $size, $_)
50 or die "can't do sql command: " . $dbh->errstr . "\n";
54 print "$num records updated\n";