Revision 13

Date:
2007/08/23 17:55:05
Author:
dpavlin
Revision Log:
optionally mirror_images, numeric ranges are now zero-padded so they sort ok
in exhibit
Files:

Legend:

 
Added
 
Removed
 
Modified
  • links/csv2js.pl

     
    17 17 my $csv_path = 'links.csv';
    18 18 my $img_path = 'img';
    19 19 my $first_line_labels = 1;
    20 my $mirror_images = 1;
    20 21 my $split_fields = {
    21 22 label => sub { return split(/,\s*/,$_[0]) },
    22 23 };
     
    207 208
    208 209 warn "## round $min - $max / $step produced ranges: ",dump( @ranges ),"\n";
    209 210
    210 my $usage;
    211 my $d = length( "$max" );
    211 212
    212 213 foreach my $i ( 0 .. $#numbers ) {
    213 214 my $n = $numbers[$i];
     
    215 216 my $start = 0;
    216 217 foreach my $r ( @ranges ) {
    217 218 if ( $n < $r ) {
    218 $dump[$i]->{ $name . '_range' } = $start . '-' . $r;
    219 $dump[$i]->{ $name . '_range' } = sprintf("%0${d}d-%0${d}d", $start, $r);
    219 220 last;
    220 221 }
    221 222 $start = $r;
     
    279 280 my $img_thumb_path = "$img_path/t/$id.jpg";
    280 281 my $img_orig_path = "$img_path/$id.jpg";
    281 282
    282 if ( mirror( $url, $img_orig_path ) != RC_NOT_MODIFIED ) {
    283 if ( $mirror_images && mirror( $url, $img_orig_path ) != RC_NOT_MODIFIED ) {
    283 284 warn "$url -> $img_orig_path\n";
    284 285 }
    285 286 system('convert', '-geometry', '320x200', $img_orig_path, $img_thumb_path ) if ! -e $img_thumb_path;