Class: StackEncode::Profile

Inherits:
Object
  • Object
show all
Defined in:
lib/stack-encode/profile.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Profile

Returns a new instance of Profile.



6
7
8
9
# File 'lib/stack-encode/profile.rb', line 6

def initialize(options = {})
  @profile_path = options[:profile_path] ? options[:profile_path] : nil
  @custom_options = options[:custom_options] ? options[:custom_options] : nil
end

Instance Method Details

#audio_optionsObject



33
34
35
36
# File 'lib/stack-encode/profile.rb', line 33

def audio_options
  audio_options = settings['audio'] ? settings['audio'] : {}
  merge_custom_options(audio_options)
end

#settingsObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/stack-encode/profile.rb', line 11

def settings
  @settings ||= if @profile_path
    begin
      YAML.load_file @profile_path
    rescue SystemCallError
      $stderr.puts "Can't find profile #{@profile_path}."
      exit 1
    rescue => e
      $stderr.puts "Error parsing profile (#{@profile_path}):"
      $stderr.puts e.message
      exit 1
    end
  else
    {}
  end
end

#transcoder_optionsObject



38
39
40
# File 'lib/stack-encode/profile.rb', line 38

def transcoder_options
  @settings['transcoder'] ? @settings['transcoder'] : {}
end

#video_optionsObject



28
29
30
31
# File 'lib/stack-encode/profile.rb', line 28

def video_options
  video_options = settings['video'] ? settings['video'] : {}
  merge_custom_options(video_options)
end