Module: ActiveEncode::Core

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/active_encode/core.rb

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Instance Method Details

#cancel!Object



66
67
68
69
70
# File 'lib/active_encode/core.rb', line 66

def cancel!
  run_callbacks :cancel do
    merge!(self.class.engine_adapter.cancel(self.id))
  end
end

#create!Object



59
60
61
62
63
64
# File 'lib/active_encode/core.rb', line 59

def create!
  # TODO: Raise ArgumentError if self has an id?
  run_callbacks :create do
    merge!(self.class.engine_adapter.create(self.input.url, self.options))
  end
end

#created?Boolean

Returns:

  • (Boolean)


90
91
92
# File 'lib/active_encode/core.rb', line 90

def created?
  !id.nil?
end

#initialize(input_url, options = nil) ⇒ Object



54
55
56
57
# File 'lib/active_encode/core.rb', line 54

def initialize(input_url, options = nil)
  @input = Input.new.tap{ |input| input.url = input_url }
  @options = options || self.class.default_options(input_url)
end

#purge!Object



72
73
74
75
76
77
# File 'lib/active_encode/core.rb', line 72

def purge!
  ActiveSupport::Deprecation.warn("#purge! will be removed without replacement in ActiveEncode 0.3")
  run_callbacks :purge do
    self.class.engine_adapter.purge self
  end
end

#reloadObject



84
85
86
87
88
# File 'lib/active_encode/core.rb', line 84

def reload
  run_callbacks :reload do
    merge!(self.class.engine_adapter.find(id))
  end
end

#remove_output!(output_id) ⇒ Object



79
80
81
82
# File 'lib/active_encode/core.rb', line 79

def remove_output!(output_id)
  ActiveSupport::Deprecation.warn("#remove_output will be removed without replacement in ActiveEncode 0.3")
  self.class.engine_adapter.remove_output self, output_id
end

#tech_metadataObject

Deprecated.


95
96
97
98
99
100
101
# File 'lib/active_encode/core.rb', line 95

def 
   = {}
  [:width, :height, :frame_rate, :duration, :file_size,
   :audio_codec, :video_codec, :audio_bitrate, :video_bitrate, :checksum].each do |key|
    [key] = input.send(key)
  end
end