support no identify and no transcode/mencoder
[booh] / lib / booh / booh-lib.rb
index e2b4d80c5e8ba46b888819019d87a6f1486ed8f3..fe89dfe4f3ec0d7302de0e2d830201ee4497594c 100644 (file)
@@ -89,7 +89,7 @@ module Booh
 
     def select_theme(name, limit_sizes, optimizefor32, nperrow)
         $theme = name
-        msg 3, _("Selecting theme `%s'") % $theme
+        msg 3, _("Selecting theme '%s'") % $theme
         themedir = "#{$FPATH}/themes/#{$theme}"
         if !File.directory?(themedir)
             die _("Theme was not found (tried %s directory).") % themedir
@@ -132,7 +132,7 @@ module Booh
     def entry2type(entry)
         if entry =~ /\.(jpg|jpeg|jpe|gif|bmp|png)$/i && entry !~ /['"\[\]]/
             return 'image'
-        elsif entry =~ /\.(mov|avi|mpg|mpeg|mpe|wmv|asx|3gp|mp4)$/i && entry !~ /['"\[\]]/
+        elsif !$ignore_videos && entry =~ /\.(mov|avi|mpg|mpeg|mpe|wmv|asx|3gp|mp4)$/i && entry !~ /['"\[\]]/
             #- might consider using file magic later..
             return 'video'
         else
@@ -189,7 +189,7 @@ module Booh
     end
 
     def get_image_size(fullpath)
-        if `identify '#{fullpath}'` =~ / JPEG (\d+)x(\d+) /
+        if !$no_identify && `identify '#{fullpath}'` =~ / JPEG (\d+)x(\d+) /
             return { :x => $1.to_i, :y => $2.to_i }
         else
             return nil
@@ -272,14 +272,7 @@ module Booh
             for dest in dests
                 if !File.exists?(dest['filename'])
                     cmd = nil
-                    #- don't resize if image is already smaller than destination size
-                    if size = get_image_size(orig)
-                        dest['size'] =~ /(\d+)x(\d+)/
-                        if (rotate == "90" || rotate == "270" || size[:x] < size[:y]) ? size[:y] < $1.to_i : size[:x] < $1.to_i
-                            cmd = "#{$convert} #{convert_options} '#{orig}' '#{dest['filename']}'"
-                        end
-                    end
-                    cmd ||= "#{$convert} #{convert_options}-size #{dest['size']} -resize #{dest['size']} '#{orig}' '#{dest['filename']}'"
+                    cmd ||= "#{$convert} #{convert_options}-size #{dest['size']} -resize '#{dest['size']}>' '#{orig}' '#{dest['filename']}'"
                     if allow_background
                         psys(cmd)
                     else