Class: Abrizer::AdaptationsFile

Inherits:
Object
  • Object
show all
Includes:
FilepathHelpers
Defined in:
lib/abrizer/adaptations_file.rb

Instance Method Summary collapse

Methods included from FilepathHelpers

#adaptations_filepath, #all_media_paths, #audio_filepath, #audio_filepath_fragmented, #basename, #canvas_filepath, #canvas_partial_filepath, #captions_filepath, #data_filepath, #data_partial_filepath, #ffprobe_filepath, #filename_directory, #first_image_filepath, #hlsts_aac_filepath, #hlsts_aac_partial_filepath, #hlsts_filepath, #hlsts_partial_filepath, #mp3_filepath, #mp3_partial_filepath, #mp4_filepath, #mp4_partial_filepath, #mpd_filepath, #mpd_partial_filepath, #output_directory, #output_directory_basename, #poster_filepath, #poster_image_filepath, #poster_partial_filepath, #sprites_filepath, #sprites_partial_filepath, #vp9_filepath, #vp9_partial_filepath, #webvtt_input_filepath

Constructor Details

#initialize(filepath, output_directory) ⇒ AdaptationsFile

Returns a new instance of AdaptationsFile.



6
7
8
9
10
# File 'lib/abrizer/adaptations_file.rb', line 6

def initialize(filepath, output_directory)
  @filepath = filepath
  @output_directory = output_directory
  FileUtils.mkdir_p @output_directory unless File.exist? @output_directory
end

Instance Method Details

#adaptationsObject



12
13
14
15
16
17
18
19
# File 'lib/abrizer/adaptations_file.rb', line 12

def adaptations
  adapt = Abrizer::AdaptationFinder.new(filepath: @filepath, output_directory: @output_directory).adaptations
  adapt_dump = adapt.map{|a| a.to_hash}
  File.open(adaptations_filepath, 'w') do |fh|
    fh.puts MultiJson.dump(adapt_dump)
  end
  adapt
end