]> mj.ucw.cz Git - gallery.git/blobdiff - gal2/gal-gen
Gallery2: More renames
[gallery.git] / gal2 / gal-gen
index 7d244fe65edad26a85e6d9d86c8c87092f1bd067..96bd65f36942725f14113e2b9d592e2662bdfc34 100755 (executable)
@@ -5,7 +5,8 @@
 use strict;
 use warnings;
 
-use lib '/home/mj/web/gal2';
+use FindBin;
+use lib $FindBin::Bin;
 use UCW::Gallery qw(%CF);
 
 use Image::Magick;
@@ -17,7 +18,6 @@ STDOUT->autoflush(1);
 
 UCW::Gallery::LoadConfig;
 
-my $orig_dir = $CF{'OrigDir'};
 my $orig_list = UCW::Gallery::ReadList('gallery.list') or die "Cannot read gallery.list: $!\n";
 
 my $photo_dir = $CF{'PhotoDir'};
@@ -35,13 +35,12 @@ if (-f $photo_meta) {
        $old_meta = UCW::Gallery::ReadMeta($photo_meta);
        # use Data::Dumper; print "Read old meta: ", Dumper($old_meta), "\n";
 }
-my $meta = { 'photo' => {}, 'sequence' => [] };
+my $meta = { 'photo' => {} };
 
 for my $f (@$orig_list) {
        my $id = $f->{id};
        my $rotate = $f->{orientation};
        my $xfrm = $f->{xfrm};
-       push @{$meta->{sequence}}, $id;
        print "$id: ";
 
        my $p = new Image::Magick;
@@ -70,6 +69,7 @@ for my $f (@$orig_list) {
                'w' => $w,
                'h' => $h,
        };
+       $meta->{photo}->{$id} = $m;
 
        my $om = $old_meta->{photo}->{$id};
        if ($om &&
@@ -79,7 +79,6 @@ for my $f (@$orig_list) {
            $om->{h} eq $m->{h}) {
                # FIXME: Remove old images?
                print "... uptodate\n";
-               $meta->{photo}->{$id} = $om;
                next;
        }
 
@@ -121,7 +120,6 @@ for my $f (@$orig_list) {
        rename $tmp, $photo or die "Cannot rename $tmp to $photo: $!\n";
 
        print "... OK\n";
-       $meta->{photo}->{$id} = $m;
 }
 
 print "Writing meta-data\n";