diff options
-rwxr-xr-x | videodb-check.pl | 76 | ||||
-rw-r--r-- | videodb.rc | 8 |
2 files changed, 80 insertions, 4 deletions
diff --git a/videodb-check.pl b/videodb-check.pl index 2f2e3cc..daab658 100755 --- a/videodb-check.pl +++ b/videodb-check.pl @@ -9,6 +9,7 @@ $VERSION = "0.1, 27 November 2011"; use DBI; +use Pod::Usage; use File::Spec::Functions; use Cwd; use Env qw /HOME/; @@ -30,6 +31,81 @@ die "Error: No such directory: `" .$symlinks. "'.\n" unless -d $symlinks; ################################################################################ +=head1 NAME + +videodb-check.pl - a sanity check for your video database + +=head1 SYNOPSIS + +B<videodb-check.pl> + +=head1 DISCLAIMER + +Your collection is assumed to have the following structure: two +folders, I<DIRECTORS> and I<MOVIES>, that have the same parent. +I<DIRECTORS> contains one subdirectory for each director, and each movie +lies (B<as a regular file>) in the subdirectory of its director. +The folder I<MOVIES> contains symlinks - one for each movie - that target +to I<../DIRECTORS/director_of_the_movie/movie>. +The behavior of B<videodb-check.pl> is NOT specified if your collection does +not verify these conventions! + + |- ... + |- DIRECTORS + | |- director1 + | |- |- movie11 + | | `- movie12 + | |- director2/ + | `- ... + `- MOVIES + |- movie11 -> ../DIRECTORS/director1/movie1 + |- movie12 -> ../DIRECTORS/director1/movie2 + `- ... + +=head1 DESCRIPTION + +B<videodb-check> performs the following sanity checks on your database +and collection: + +=over 4 + +=item * + +Each entry in the database has a corresponding symlink under the +directory I<MOVIES> of your collection, that in turn has a valid target +in the directory I<DIRECTORS>. + +=item * + +Each symlink in the directory I<MOVIES> of your collection has exactly +one corresponding entry in the database. + +=back + +=head1 EXIT STATUS + +The exit status is 0 if your collection and database are sane, and 1 +otherwise. + +=head1 REQUIREMENTS + +The imported modules are available on CPAN. See the source for details. + +=head1 AUTHOR + +Copyright 2011 Guilhem Moulin. See the source for copying conditions. + +=cut + +################################################################################ + +if (@ARGV) { + pod2usage(-exitstatus => 0, -verbose => 2) if $ARGV[0] eq '--man'; + pod2usage(2); +} + +################################################################################ + # Connect to database my $dsn = "DBI:$config{driver}:database=$config{database};host=$config{hostname};port=$config{port}"; my $dbh = DBI->connect($dsn, $config{user}, $config{password}) @@ -1,7 +1,7 @@ -######################################################################### -# This is a sample configuration file for video-*. Extend it and rename # -# it to `~/.videodb.rc' # -######################################################################### +######################################################################## +# This is a sample configuration file for video*. Extend it and rename # +# it to `~/.videodb.rc' # +######################################################################## videodir => catdir($HOME,'video'), driver => 'mysql', |