From 6cb5a542ee240c557a0f20a11d350e8dc5f22092 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Fri, 6 Jan 2012 20:12:28 +0100 Subject: man --- videodb-check.pl | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) (limited to 'videodb-check.pl') 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 + +=head1 DISCLAIMER + +Your collection is assumed to have the following structure: two +folders, I and I, that have the same parent. +I contains one subdirectory for each director, and each movie +lies (B) in the subdirectory of its director. +The folder I contains symlinks - one for each movie - that target +to I<../DIRECTORS/director_of_the_movie/movie>. +The behavior of B 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 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 of your collection, that in turn has a valid target +in the directory I. + +=item * + +Each symlink in the directory I 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}) -- cgit v1.2.3