lib/falcon/encoder.rb in falcon-0.1.0 vs lib/falcon/encoder.rb in falcon-0.1.1

- old
+ new

@@ -22,10 +22,11 @@ attr_accessible :name, :profile_name, :source_path validates_presence_of :name, :profile_name, :source_path before_validation :set_resolution + before_destroy :remove_output scope :with_profile, lambda {|name| where(:profile_name => Falcon::Profile.detect(name).name) } scope :with_name, lambda {|name| where(:name => name) } scope :processing, where(:status => PROCESSING) scope :success, where(:status => SUCCESS) @@ -215,9 +216,13 @@ end rescue ::WebVideo::CommandLineError => e ::WebVideo.logger.error("Unable to generate screenshots for video #{self.id}: #{e.class} - #{e.message}") return false end + end + + def remove_output + FileUtils.rm(output_path, :force => true) if File.exists?(output_path) end end end end