module Falcon::Encoder::ClassMethods

def self.extended(base)

def self.extended(base)
  base.class_eval do
    belongs_to :videoable, :polymorphic => true
    
    attr_accessor :ffmpeg_resolution, :ffmpeg_padding
    
    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)
    scope :failure, where(:status => FAILURE)
  end
end