#!/usr/bin/env perl -U -I .

$ZPHOTO = "/usr/local/bin/zphoto";
$NAMERAKAFILE = "/home/pochi/src/NamerakaAlbumManual/";

use Getopt::Long;
use POSIX qw(strftime ceil);

Getopt::Long::Configure('bundling');
my ($outputdir, $title);
my $gor = GetOptions('o|output-dir=s'   => \$outputdir,
		     'title=s' => \$title);

if (@ARGV == 0 or $gor == 0) {
    print << "USAGE";
usage: photoup -o <outputdir> --title="<title>" <file> [file]...
USAGE
    ;
    exit;
}

$zphotoarg = ' -o ' . $outputdir . ' --title="' . $title . '"';
foreach $w (@ARGV) {
    $zphotoarg .= ' ';
    $zphotoarg .= $w;
}

print "zphotoarg=" . $zphotoarg . "\n";

system $ZPHOTO . $zphotoarg;

system "mv $outputdir/index.html $outputdir/zphoto.html";
system "cp $NAMERAKAFILE/* $outputdir/";

system "(cd $outputdir ; ls pv-*.JPG > photo.txt)";
