new gen_video_thumbnail because of transcode->mplayer switch
[booh] / bin / booh-classifier
index b0bde2f86ddcc999bb15cf7a5282e45d8dba9bbd..b82e364703016c38e8c208dee8afb8e06b3ffd83 100644 (file)
@@ -375,11 +375,11 @@ class Entry
                 tmp.close!
                 Dir.mkdir(dest_dir = tmp.path)
                 orig_base = File.basename(path)
-                if ! gen_video_thumbnail(path, dest_dir, orig_base, false, 0)
-                    cleanup_dir(dest_dir)
+                tmpdir = gen_video_thumbnail(path, false, 0)
+                if tmpdir.nil?
                     return
                 end
-                image_path = "#{dest_dir}/#{orig_base}.jpg000000.jpg"
+                image_path = "#{tmpdir}/00000001.jpg"
             else
                 image_path = @path
             end
@@ -388,6 +388,11 @@ class Entry
             rescue Gdk::PixbufError
                 msg 0, "Cannot load #{image_path}: #{$!}"
                 return
+            ensure
+                if @type == 'video'
+                    File.delete(image_path)
+                    Dir.rmdir(tmpdir)
+                end
             end
             if @pixbuf_full
                 if @angle.nil?