label lossless WMA as WMA3/Lossless
[soepkiptng.git] / soepkiptng_update7.pl
blob047896e268a3f053217f067b7a99421c042e78ad
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 integer;
21 use Cwd 'abs_path';
22 use DBI;
23 use Socket;
24 use Getopt::Std;
26 # find program directory
27 $_ = $0;
28 while(-l) {
29 my $l = readlink or die "readlink $_: $!\n";
30 if($l =~ m|^/|) { $_ = $l; } else { s|[^/]*$|/$l|; }
32 m|(.*)/|;
33 my $progdir = abs_path($1);
35 require "$progdir/soepkiptng.lib";
37 getopts('c:');
39 read_configfile(\%conf, $opt_c);
41 $dbh = connect_to_db(\%conf);
43 $files = $dbh->selectcol_arrayref("SELECT filename FROM song WHERE present AND filesize IS NULL AND filename LIKE '/%'");
44 $num = 0;
45 foreach(@$files) {
46 defined($size = -s $_) or next;
47 $dbh->do("UPDATE song SET filesize=? WHERE filename=?", undef, $size, $_)
48 or die "can't do sql command: " . $dbh->errstr . "\n";
49 $num++;
51 END {
52 print "$num records updated\n";