2 # UCW Gallery -- Master Program
3 # (c) 2012 Martin Mares <mj@ucw.cz>
10 my $gallery_root = $FindBin::Bin;
14 Usage: gal <general-options> <command> <command-options> <args>
20 scan Scan directory and obtain originals
21 gen Generate web photos from originals
22 cache Rebuild thumbnails and other cached info
25 dump-config Show configuration settings
26 dump-meta Show contents of metadata files
27 from-gqview Parse gqview/geeqie collections
32 Getopt::Long::Configure('require_order');
34 "help" => \&show_help,
36 print "UCW Gallery 2.0 (c) 2004-2012 Martin Mares <mj\@ucw.cz>\n";
38 ) or die "Try `gal help' for more information.\n";
39 Getopt::Long::Configure('default');
41 @ARGV or die "Missing subcommand.\n";
42 my $sub = shift @ARGV;
43 $sub =~ /^[0-9a-zA-Z-]+$/ or die "Invalid subcommand $sub\n";
45 if ($sub eq 'help') { show_help(); }
47 my $sub_path = "$gallery_root/bin/gal-$sub";
48 -x $sub_path or die "Unknown subcommand $sub\n";
50 $ENV{"GALLERY_ROOT"} = $gallery_root;
51 $ENV{"PERL5LIB"} = join(":", $gallery_root, $ENV{"PERL5LIB"} // ());
52 exec $sub_path, @ARGV;
53 die "Cannot execute $sub_path: $!\n";