From 7afca45ce9dc21300cffa2d6636eb0d69eecf1cb Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Wed, 11 Jan 2012 18:07:16 +0100 Subject: more checks --- videodb-check.pl | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'videodb-check.pl') 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 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]); +} -- cgit v1.2.3