#!/local/bin/perl5.8.5 eval 'exec /usr/local/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell eval 'exec /usr/app/bin/perl -S $0 ${1+"$@"}' if 0; # not running under some shell # # # File: recurtn.pl # # Author: Nem W Schlecht # Copyright © 2004 Empyreal Technologies # # Creation Date: Jun 12, 2003 # Last Modification: $Date$ # # $Id$ # $Log$ # use Gimp ":auto"; use Gimp::Fu; use strict; use File::Find; use Digest::MD5; require 'pwd.pl'; my $md5 = new Digest::MD5; #Gimp::set_trace(TRACE_ALL); my(@files); sub recurtn { my $dir = shift; if ($dir !~ /^\//) { print "Please specify absolute path!\n"; exit; } gimp_progress_init("Generating Thumbnails...",-1); find({ wanted => \&wanted }, "$dir"); for (my $i=0;$i<=$#files;++$i) { my $fn = $files[$i]; gimp_progress_update($i/$#files); my $mdfn = "file://" . $fn; $md5->add($mdfn); my $tnfn = $md5->hexdigest(); if (-e "$ENV{HOME}/.thumbnails/normal/$tnfn" . ".png" || -e "$ENV{HOME}/.thumbnails/large/$tnfn" . ".png") { next; } # print "$fn\n"; eval {my $img = gimp_file_load("$fn", "$fn"); $img->gimp_file_save_thumbnail("$fn")}; } return(); } sub wanted { my $fn = $File::Find::name; next if (-d "$fn"); next if ($fn =~ /\/\.xvpics\//); push(@files, $fn); } register "recursive_thumbnail", # fill in name "Recursively Create Thumbnails", # a small description "Recursively Create Thumbnails", # a help text "Nem Schlecht", "Nem Schlecht (C) 2004", "2004-04-12", N_"/Xtns/Recursive TNG", # menu path "*", # Image types [ [PF_FILE, "root_dir", "Root Dir", $ENV{PWD}], ], \&recurtn; exit main();