Class: Abrizer::Cleaner
Instance Method Summary
collapse
#adaptations_filepath, #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(filename, output_dir = nil) ⇒ Cleaner
Returns a new instance of Cleaner.
6
7
8
9
10
|
# File 'lib/abrizer/cleaner.rb', line 6
def initialize(filename, output_dir=nil)
@filename = filename
@output_directory = output_dir
@adaptations = Abrizer::AdaptationFinder.new(@filename).adaptations
end
|
Instance Method Details
#clean ⇒ Object
12
13
14
15
16
|
# File 'lib/abrizer/cleaner.rb', line 12
def clean
delete_adaptations(@adaptations)
clean_audio_file
remove_pass1_log_files
end
|
#clean_audio_file ⇒ Object
25
26
27
|
# File 'lib/abrizer/cleaner.rb', line 25
def clean_audio_file
FileUtils.rm audio_filepath_fragmented if File.exist? audio_filepath_fragmented
end
|
#delete_adaptations(adapts) ⇒ Object
18
19
20
21
22
23
|
# File 'lib/abrizer/cleaner.rb', line 18
def delete_adaptations(adapts)
adapts.map do |adaptation|
filepath = adaptation.filepath_fragmented(@filename, output_directory)
FileUtils.rm filepath if File.exist? filepath
end
end
|
#remove_pass1_log_files ⇒ Object
29
30
31
32
33
34
|
# File 'lib/abrizer/cleaner.rb', line 29
def remove_pass1_log_files
glob = File.join output_directory, "ffmpeg2pass*"
Dir.glob(glob).each do |log_filepath|
FileUtils.rm log_filepath
end
end
|