new cthumb release - 4.1.5 - tps's changes

Carlos Puchol <[email protected]> Mon, 12 Aug 2002 17:27:14 -0500
Newsgroups gmane.comp.web.cthumb.announce
Message-ID <[email protected]>
these are terry's changes.

before i put them in the cvs, could you guys take it for a spin?
from my end it looks ok. the patches were not straightforward
to apply (my eternal complaint, that it why it took more time than
usual :)

i put a version with this changes, called 4.1.5.

http://cthumb.sourceforge.net

i don't like the default to html instead of shtml, but i
will let it slide for this development version.
i'm not announcing it in freshmeat, etc.

-c

Index: ChangeLog
===================================================================
RCS file: /cvsroot/cthumb/cthumb/ChangeLog,v
retrieving revision 1.27
diff -u -p -r1.27 ChangeLog
--- ChangeLog	9 Aug 2002 15:44:28 -0000	1.27
+++ ChangeLog	12 Aug 2002 22:20:12 -0000
@@ -1,3 +1,16 @@
+Fri Aug  9 11:14:54 CDT 2002 Terry Gliedt <[email protected]>
+
+	* cthumb.in:
+	  - shorten long titles and descriptions to 50 chars.
+	  - join lines that end in '\'
+	  - parse_option loop optimizations
+	  - add HtmlExtension variable
+	  - add -H option for listing all variables available and
+	    where they apply
+	  - cut down long commentaries
+	  - fix InlineFiles bug, should work now.
+	  - fix diff issue for solaris
+
 Fri Aug  9 10:38:41 CDT 2002 Artur Kedzierski <[email protected]>
 
 	* themes/{ithumb,spotlight}.theme/theme.conf: link color fix
Index: VERSION
===================================================================
RCS file: /cvsroot/cthumb/cthumb/VERSION,v
retrieving revision 1.13
diff -u -p -r1.13 VERSION
--- VERSION	15 Dec 2001 22:37:51 -0000	1.13
+++ VERSION	12 Aug 2002 22:20:12 -0000
@@ -1 +1 @@
-4.1
+4.1.5
Index: cthumb.in
===================================================================
RCS file: /cvsroot/cthumb/cthumb/cthumb.in,v
retrieving revision 1.19
diff -u -p -r1.19 cthumb.in
--- cthumb.in	2 Aug 2002 22:50:40 -0000	1.19
+++ cthumb.in	12 Aug 2002 22:20:12 -0000
@@ -87,7 +87,8 @@ my @options = (
 	["InsertExif"                 , "boolean", "" , "0"               , " ", "c", " ", "generate automatic Exif info"],
 	["UseMogrify"                 , "boolean", "" , "0"               , " ", "c", " ", "use mogrify for scaling and rotating - required for image rotation"],
 	["RecursiveCP"                , "string" , "" , "@CPR@"           , " ", "x", "x", "'cp -a' for gnu cp, set to 'cp -r' for bsd, else 'rsync -avq'"],
-	["ImageDir"                   , "string" , "" , "@themedir@"      , " ", "c", "x", "directory where themes are found"]
+	["ImageDir"                   , "string" , "" , "@themedir@"      , " ", "c", "x", "directory where themes are found"],
+	["HtmlExtension"              , "string" , "" , "html"            , " ", " ", "x", "files to create - typically html, shtml or php"],
 	);
 
 ############################
@@ -143,6 +144,7 @@ my $InsertExif = 0;
 my $UseMogrify = 0;
 my $RecursiveCP = '';
 my $ImageDir = '';
+my $HtmlExtension = '';
 
 my %opt = ();			# Option flags saved here
 my $InsertExifUrl = '';		# For broken InsertExif code
@@ -182,7 +184,27 @@ my $TotalThumbWidth=1;		# left + width +
 {
     init_options ();
 
-    &getopt('lfxyis', \%opt);
+    &getopt('Hlfxyis', \%opt);
+
+    if (exists($opt{H})) {	    # Show synopsis of cthumb keywords
+        print "These are valid cthumb keywords:\n";
+        foreach my $o (@options) {
+            print "  $o->[0]: $o->[7]\n";
+            print "    Data type: '$o->[1]'  Default value: '$o->[3]'\n";
+            my $allowed = '';
+            my $notallowed = '';
+            if ($o->[4] eq ' ') { $allowed .= '.cthumbrc, '; }
+            else { $notallowed .= '.cthumbrc, '; }
+            if ($o->[5] eq ' ') { $allowed .= '.album files, '; }
+            else { $notallowed .= '.album files, '; }
+            if ($o->[6] eq ' ') { $allowed .= 'theme files,'; }
+            else { $notallowed .= 'theme files,'; }
+            if ($allowed ne '') { chop($allowed); print "    Allowed in $allowed\n"; }
+            if ($notallowed ne '') { chop($notallowed); print "    NOT allowed in $notallowed\n"; }
+            if ($o->[2] ne '') { print "    May be overridden using option '-$o->[2]'\n"; }
+        }
+	    exit 0;
+    }
 
     if (! @ARGV ) {
 	print "usage: cthumb [opts] <fname.album> ...\n\n";
@@ -368,12 +390,12 @@ sub parse_option {
 		 $options[$i][1] eq "boolean") &&
 		/^$pattern:\s*(\d+)/i) { # integer/boolean w/ or w/o comment
 		eval "\$$options[$i][0] = int($1)";
-			next;
+			last LOOP;
 	    }
 	    if ($options[$i][1] eq "string" &&
 		/^$pattern:\s*(.*)\s*?$/i) { # string w/o comment
 		eval "\$$options[$i][0] = \"$1\"";
-			next;
+			last LOOP;
 	    }
 	    if ($options[$i][1] eq "array" &&
 		/^$pattern:\s*(.*)\s*?$/i) { # array w/o comment
@@ -383,7 +405,7 @@ sub parse_option {
 		    $NLanguages = $#Languages + 1;
 		    # print "DEBUG: NLanguages: $NLanguages\n";
 		}
-			next;
+			last LOOP;
 	    }
 	    # print "DEBUG: $pattern = $1 ($cmdopt)\n";
 	    last LOOP;
@@ -473,7 +495,7 @@ sub do_file {
     /^(.*?)(\.desc|\.txt|\.album)?$/;
     $descindex = $1;
     if ($MainIndexName eq "") {
-	$MainIndexName = $descindex . "-index.shtml";
+	$MainIndexName = $descindex . "-index.$HtmlExtension";
     }
     my $indextmp = "/tmp/.$descindex.tmp.$$";
     if (!open (ALBUM, "<$descfname")) {
@@ -557,7 +579,7 @@ sub do_file {
     if ($NoMainIndex) {
 	unlink($indextmp);
     } else {
-        if (system ("diff -q $indextmp $MainIndexName &> /dev/null")) {
+        if (system ("diff $indextmp $MainIndexName >/dev/null 2>/dev/null")) {
 	    print "Index for $descfname in: $MainIndexName\n";
 	    my $cmd = "mv $indextmp $MainIndexName";
 	    if (system($cmd)) { print "cthumb warning: command '$cmd' failed: $!\n"; }
@@ -618,9 +640,9 @@ sub index_html_header {
     $str .= "</title>\n</head>\n";
     $str .= "<body text=\"#000088\" bgcolor=\"$TitleBgColor\" link=\"#000033\" ";
     $str .= "vlink=\"#666600\" alink=\"#ff0000\">\n";
-    if (-e $InlineFiles . $header) {
+    if (-e "$InlineFiles/$header") {
         if ($InlineFiles ne "") {
-	    $str .= inline_file ($header);
+	    $str .= inline_file ("$InlineFiles/$header");
         } else {
 	    $str .= "<!--#include virtual=\"" . $header . "\" paco: $InlineFiles --><br>\n";
         }
@@ -662,12 +684,12 @@ sub create_index_entry {
     for my $i (1..$NLanguages) {
 	$append = "";
 	if ($fname !~ /\.s?html$/i) { # if not an html file, guess rationally
-	    if ($NLanguages > 1 && -e ($fname . "-$i.shtml")) {
-		$append =  "-$i.shtml";
-	    } elsif (-e ($fname . ".shtml")) {
-		$append = ".shtml";
+	    if ($NLanguages > 1 && -e ($fname . "-$i.$HtmlExtension")) {
+		$append =  "-$i.$HtmlExtension";
+	    } elsif (-e ($fname . ".$HtmlExtension")) {
+		$append = ".$HtmlExtension";
 	    } else {
-		$append = ".html"; # ok, last attempt. hope the html is there!
+		$append = ".$HtmlExtension"; # ok, last attempt. hope the html is there!
 	    }
 	}
 	$str .= "<td align=\"center\" valign=\"middle\">";
@@ -784,7 +806,7 @@ sub create_page_html {
         my $fname = "$basename$appendage";
 
         # if it comes with a full file name already, do not append the extension
-        $fname .= ".shtml" if ($basename !~ /\.s?html$/i);
+        $fname .= ".$HtmlExtension" if ($basename !~ /\.s?html$/i);
 
 	my $text = "";
 	# if only one row, maybe we have less pictures than $PicturesPortRow, so we need to adjust
@@ -946,7 +968,7 @@ sub generate_slide_show {
             # be displayed by "100-0103-1-1-1.shtml".
             push @generatedSlideURLArray, "$outputPath/$filename-" .
 		$PageNumber . "-" . $scaleIndexNumber .
-                $slideURLPostfix . ".shtml";
+                $slideURLPostfix . ".$HtmlExtension";
 
 	    $scaleIndexNumber++;
         }


-------------------------------------------------------
This sf.net email is sponsored by: Dice - The leading online job board
for high-tech professionals. Search and apply for tech jobs today!
http://seeker.dice.com/seeker.epl?rel_code=31