]> mj.ucw.cz Git - gallery.git/commitdiff
Gallery2: Upgrade 2012
authorMartin Mares <mj@ucw.cz>
Thu, 27 Dec 2012 22:31:54 +0000 (23:31 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 8 Feb 2015 20:14:15 +0000 (21:14 +0100)
gal2/bin/gal-mj-upgrade [new file with mode: 0755]

diff --git a/gal2/bin/gal-mj-upgrade b/gal2/bin/gal-mj-upgrade
new file mode 100755 (executable)
index 0000000..cc31898
--- /dev/null
@@ -0,0 +1,25 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Cwd;
+
+my $photos_root = $ENV{HOME} . '/photos';
+
+my $album = $ARGV[0];
+if (!defined $album) {
+       my $cwd = getcwd;
+       $cwd =~ m{/photos/(.*)} or die "Cannot identify album from current directory, need to specify maunally.\n";
+       $album = $1;
+}
+
+open I, "index.cgi" or die;
+open S, "|-", "gal scan" or die;
+while (<I>) {
+       /^img\(/ or next;
+       /# .*(IMG_.*\.JPG) / or die;
+       print S "$photos_root/$album/$1\n";
+}
+close S or die;
+close I;