more tweaks to switch to factors
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 15 Oct 2009 18:52:01 +0000 (20:52 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 15 Oct 2009 18:52:01 +0000 (20:52 +0200)
bin/mplayer.pl

index 837d23a..1ad67ec 100755 (executable)
@@ -203,15 +203,20 @@ sub html5tv {
                        mkdir $path;
                        warn "created $path\n";
 
-                       foreach my $hires ( @slides_hires ) {
+               }
 
-                               my $file = $hires;
-                               $file =~ s{^.+/(p\d+\.\w)}{$path/$1};
+               my $path = "$media_dir/s/$factor";
 
-                               my $im = Imager->new( file => $hires );
-                               $im->scale( xpixels => $w, ypixels => $h, type => 'min' )->write( file => $file );
-                               warn "resized $file ", -s $file, " bytes\n";
-                       }
+               foreach my $hires ( @slides_hires ) {
+
+                       my $file = $hires;
+                       $file =~ s{(\d+\.\w)$}{$path/$1} || warn "can't rewrite $file";
+                       warn "slide $hires $file\n";
+                       next if -e $file;
+
+                       my $im = Imager->new( file => $hires );
+                       $im->scale( xpixels => $w, ypixels => $h, type => 'min' )->write( file => $file );
+                       warn "resized $file ", -s $file, " bytes\n";
                }
 
        }