diff options
-rwxr-xr-x | videodb-check.pl | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/videodb-check.pl b/videodb-check.pl index f56a090..8acff46 100755 --- a/videodb-check.pl +++ b/videodb-check.pl @@ -85,6 +85,11 @@ the database. Each symlink in the directory I<MOVIES> of your collection has exactly one corresponding entry in the database. +=item * + +No movie in the database has invalid release date, empty title or empty +language. + =back =head1 CONFIGURATION @@ -214,15 +219,18 @@ foreach (@filelist) { push @files, $_ unless $#res == 0; } $sth->finish; -$dbh->disconnect; +&report ("The following files have <> 1 corresponding entries in the DB", \@files); -&report ("The following files have <> 1 corresponding entries in the DB", \@files); +&check ( "no release date", "year = 0" ); +&check ( "no language set", "language IS NULL OR language =''" ); +&check ( "no title set", "title IS NULL OR title =''" ); ################################################################################ +$dbh->disconnect; exit $r; @@ -239,3 +247,11 @@ sub report { $r = 1; } } + +sub check { + my $bad = $dbh->selectall_arrayref( "SELECT filename + FROM $config{videodata} + WHERE " .$_[1] ) + or die "Can't select: " .$dbh->errstr. "\n"; + &report ("The following files have " .$_[0], [map {$_->[0]} @$bad]); +} |