module BPL::Derivatives::Processors::ShellBasedProcessor
Constants
- BLOCK_SIZE
Public Instance Methods
encode_file(file_suffix, options)
click to toggle source
# File lib/bpl/derivatives/processors/shell_based_processor.rb, line 30 def encode_file(file_suffix, options) temp_file_name = output_file(file_suffix) self.class.encode(source_path, options, temp_file_name) finalize_derivative_output(File.read(temp_file_name)) File.unlink(temp_file_name) end
options_for(_format)
click to toggle source
override this method in subclass if you want to provide specific options. returns a hash of options that the specific processors use
# File lib/bpl/derivatives/processors/shell_based_processor.rb, line 26 def options_for(_format) {} end
output_file(file_suffix)
click to toggle source
# File lib/bpl/derivatives/processors/shell_based_processor.rb, line 37 def output_file(file_suffix) Dir::Tmpname.create(['sufia', ".#{file_suffix}"], BPL::Derivatives.temp_file_base) {} end
process()
click to toggle source
# File lib/bpl/derivatives/processors/shell_based_processor.rb, line 17 def process format = directives[:format] raise ArgumentError, "You must provide the :format you want to transcode into. You provided #{directives}" unless format # TODO: if the source is in the correct format, we could just copy it and skip transcoding. encode_file(format, options_for(format)) end