start video thumbnails at frame 0
authorgc <gc>
Fri, 15 Apr 2005 22:43:20 +0000 (22:43 +0000)
committergc <gc>
Fri, 15 Apr 2005 22:43:20 +0000 (22:43 +0000)
bin/booh
bin/booh-gui
lib/booh/booh-lib.rb

index 9a8fea5e344458a53bd3b2f5223f86c151be523f..1e4bd2ccc8a3f73e87a6b4edd7ee42c247f60843 100755 (executable)
--- a/bin/booh
+++ b/bin/booh
@@ -406,7 +406,7 @@ def walk_source_dir
                 psys("cp '#{dir}/#{video}' '#{destvideo}'")
             end
             #- cleanup temp
-            system("rm -f #{dest_dir}/screenshot.jpg00000*")
+            system("rm -f #{dest_dir}/screenshot.jpg000000.jpg")
         }
 
         #- fake for gettext to find these; if themes need more sizes, english name for them should be added here
@@ -612,7 +612,7 @@ def walk_source_dir
                 html_index.gsub!(/~~caption_iteration~~/, xmldir.attributes['thumbnails-caption'])
             end
             #- cleanup temp for videos
-            system("rm -f #{dest_dir}/screenshot.jpg00000*")
+            system("rm -f #{dest_dir}/screenshot.jpg000000.jpg")
 
             #- deal with sub-albums (direct to subdirs/index.html pages)
             xmldir.elements.each('dir') { |child|
@@ -625,7 +625,7 @@ def walk_source_dir
                 html_index.gsub!(/~~caption_iteration~~/, caption)
                 html_index.gsub!(/~~image_iteration~~/, "<a href='#{make_dest_filename(subdir)}/index.html'>" + img_element(thumbnail) + '</a>')
                 #- cleanup temp for videos
-                system("rm -f #{dest_dir}/screenshot.jpg00000*")
+                system("rm -f #{dest_dir}/screenshot.jpg000000.jpg")
             }
 
             html_index += close_iterations(iterations)
index bdd2ad6c34cfdb38adbe013f734bd17122a8fe8d..2717445f77e1052ac9e28bd66ff4e70b6bdca47a 100755 (executable)
@@ -374,7 +374,7 @@ def gen_real_thumbnail(type, origfile, destfile, xmldir, size, img)
         $rotated_pixbufs[destfile] = { :orig => img.pixbuf, :pixbuf => img.pixbuf, :angle_to_orig => 0 }
         if entry2type(origfile) == 'video'
             #- cleanup temp for videos
-            system("rm -f #{current_dest_dir}/screenshot.jpg00000*")
+            system("rm -f #{current_dest_dir}/screenshot.jpg000000.jpg")
         end
         pop_mousecursor
     }
@@ -870,6 +870,7 @@ def change_dir
                 xmldir.delete_attribute("#{infotype}-rotate")
                 xmldir.delete_attribute("#{infotype}-color-swap")
                 xmldir.delete_attribute("#{infotype}-enhance")
+                xmldir.delete_attribute("#{infotype}-frame-offset")
                 my_gen_real_thumbnail.call
             end
             fc.destroy
index bdb3302c5a3b87ffeee0ffaa74d44537d8dfd8f7..4c9ca7b3f617d31bb65ebc304bc8b382823ccc42 100644 (file)
@@ -224,7 +224,7 @@ module Booh
                 #- frame-offset is an attribute that allows to specify which frame to use for the thumbnail
                 frame_offset = felem.attributes["#{attributes_prefix}frame-offset"]
                 if !frame_offset
-                    felem.add_attribute("#{attributes_prefix}frame-offset", frame_offset = "5")
+                    felem.add_attribute("#{attributes_prefix}frame-offset", frame_offset = "0")
                 end
                 frame_offset = frame_offset.to_i
                 if rotate = felem.attributes["#{attributes_prefix}rotate"]
@@ -235,30 +235,35 @@ module Booh
                 end
             end
             for dest in dests
-                if !File.exists?("#{dest_dir}/screenshot.jpg000004.jpg")
+                if !File.exists?("#{dest_dir}/screenshot.jpg000000.jpg")
                     transcode_options = ''
                     if felem
                         if felem.attributes["#{attributes_prefix}color-swap"]
                             transcode_options += '-k '
                         end
                     end
-                    cmd = "transcode -a 0 -c #{frame_offset-5}-#{frame_offset} -i '#{orig}' -y jpg -o '#{dest_dir}/screenshot.jpg' #{transcode_options} 2>&1"
+                    cmd = "transcode -a 0 -c #{frame_offset}-#{frame_offset+1} -i '#{orig}' -y jpg -o '#{dest_dir}/screenshot.jpg' #{transcode_options} 2>&1"
                     msg 2, cmd
                     results = subproc_runaway_aware(cmd)
-                    if results =~ /skipping frames/ && results !~ /encoding frame/
-                        msg 0, _("specified frame-offset probably too large. max frame was: %s.") % results.scan(/skipping frames \[000000-(\d+)\]/)[-1]
+                    if results =~ /skipping frames/ && results =~ /encoded 0 frames/
+                        msg 0, _("specified frame-offset too large? max frame was: %s. that may also be another probleme. try another value.") %
+                               results.scan(/skipping frames \[000000-(\d+)\]/)[-1]
                         return false
-                    elsif results =~ /V: import format.*unknown/ || !File.exists?("#{dest_dir}/screenshot.jpg000004.jpg")
+                    elsif results =~ /V: import format.*unknown/ || !File.exists?("#{dest_dir}/screenshot.jpg000000.jpg")
                         msg 2, _("* could not extract first image of video %s with transcode, will try first converting with mencoder") % orig
-                        cmd = "mencoder '#{orig}' -nosound -ovc lavc -lavcopts vcodec=mjpeg -o '#{dest_dir}/foo.avi' -frames #{frame_offset} -fps 25 >/dev/null 2>/dev/null"
+                        cmd = "mencoder '#{orig}' -nosound -ovc lavc -lavcopts vcodec=mjpeg -o '#{dest_dir}/foo.avi' -frames #{frame_offset+1} -fps 25 >/dev/null 2>/dev/null"
                         msg 2, cmd
                         system cmd
                         if File.exists?("#{dest_dir}/foo.avi")
-                            cmd = "transcode -a 0 -c #{frame_offset-5}-#{frame_offset} -i '#{dest_dir}/foo.avi' -y jpg -o '#{dest_dir}/screenshot.jpg' #{transcode_options} 2>&1"
+                            cmd = "transcode -a 0 -c #{frame_offset}-#{frame_offset+1} -i '#{dest_dir}/foo.avi' -y jpg -o '#{dest_dir}/screenshot.jpg' #{transcode_options} 2>&1"
                             msg 2, cmd
                             results = subproc_runaway_aware(cmd)
                             system("rm -f '#{dest_dir}/foo.avi'")
-                            if results =~ /V: import format.*unknown/ || !File.exists?("#{dest_dir}/screenshot.jpg000004.jpg")
+                            if results =~ /skipping frames/ && results =~ /encoded 0 frames/
+                                msg 0, _("specified frame-offset too large? max frame was: %s. that may also be another probleme. try another value.") %
+                                       results.scan(/skipping frames \[000000-(\d+)\]/)[-1]
+                                return false
+                            elsif results =~ /V: import format.*unknown/ || !File.exists?("#{dest_dir}/screenshot.jpg000000.jpg")
                                 msg 0, _("could not extract first image of video %s encoded by mencoder") % "#{dest_dir}/foo.avi"
                                 return false
                             end
@@ -269,7 +274,7 @@ module Booh
                     end
 
                 end
-                sys("#{$convert} #{convert_options}-size #{dest['size']} -resize #{dest['size']} #{dest_dir}/screenshot.jpg000004.jpg '#{dest['filename']}'")
+                sys("#{$convert} #{convert_options}-size #{dest['size']} -resize #{dest['size']} #{dest_dir}/screenshot.jpg000000.jpg '#{dest['filename']}'")
             end
             return true
         end