lib/abrizer/cli.rb in abrizer-0.3.0 vs lib/abrizer/cli.rb in abrizer-0.4.0

- old
+ new

@@ -1,16 +1,28 @@ require 'thor' + +if ENV['DEBUG_ABRIZER'] + require 'byebug' +end + module Abrizer class CLI < Thor desc 'all <filepath> <output_directory> <base_url>', 'Run all processes including creating ABR streams, progressive download versions, and images and video sprites.' def all(filepath, output_dir, base_url) filepath = File.expand_path filepath output_dir = File.expand_path output_dir Abrizer::All.new(filepath, output_dir, base_url).run end + desc 'ffprobe <filepath> <output_directory>', 'Save the output of ffprobe to a file as JSON' + def ffprobe(filepath, output_dir) + filepath = File.expand_path filepath + output_dir = File.expand_path output_dir + Abrizer::FfprobeFile.new(filepath, output_dir).run + end + desc 'abr <filepath> <output_directory>', 'From file create ABR streams, includes processing MP4 adaptations for packaging' def abr(filepath, output_dir=nil) filepath = File.expand_path filepath output_dir = File.expand_path output_dir Abrizer::Processor.process(filepath, output_dir) @@ -37,13 +49,13 @@ filepath = File.expand_path filepath output_dir = File.expand_path output_dir Abrizer::ProgressiveVp9.new(filepath, output_dir).create end - desc 'adaptations <filepath>', 'Display which adaptations will be created from input file' - def adaptations(filepath) - adaptations = Abrizer::AdaptationFinder.new(filepath).adaptations + desc 'adaptations <filepath> <output_directory>', 'Output which adaptations will be created from input file to a JSON file and output to console' + def adaptations(filepath, output_directory=nil) + adaptations = Abrizer::AdaptationsFile.new(filepath, output_directory).adaptations puts adaptations end desc 'inform <filepath>', 'Display information about the video/audio file' def inform(filepath) @@ -67,10 +79,19 @@ else puts "Not a valid packaging value. Try dash or hls." end end + desc 'mp3 <filepath> <output_directory>', 'Create a progressive MP3 file from the audio of the original media' + def mp3(filepath, output_directory) + # TODO: repeating expanding filepath and output_directory is probably the + # most annoying thing in this library. DRY this up somehow. + filepath = File.expand_path filepath + output_dir = File.expand_path output_directory + Abrizer::ProgressiveMp3.new(filepath, output_dir).create + end + desc 'sprites <filepath> <output_directory>', 'Create image sprites and metadata WebVTT file' def sprites(filepath, output_dir=nil) filepath = File.expand_path filepath output_dir = File.expand_path output_dir Abrizer::Sprites.new(filepath, output_dir).create @@ -87,14 +108,20 @@ filepath = File.expand_path filepath output_dir = File.expand_path output_dir Abrizer::Captions.new(filepath, output_dir).copy end - desc 'canvas <filepath> <output_directory> <base_url>', 'Creates a IIIF Canvas JSON-LD document as an API into the resources' + desc 'canvas <filepath_or_identifier> <output_directory> <base_url>', 'Creates a IIIF Canvas JSON-LD document as an API into the resources' def canvas(filepath, output_directory, base_url) filepath = File.expand_path filepath output_directory = File.expand_path output_directory Abrizer::Canvas.new(filepath, output_directory, base_url).create + end + + desc 'data <filepath_or_identifier> <output_directory> <base_url>', 'Creates a JSON file with data about the video resources.' + def data(filepath, output_directory, base_url) + output_directory = File.expand_path output_directory + Abrizer::Data.new(filepath, output_directory, base_url).create end desc 'clean <filepath> <output_directory>', 'Clean up intermediary files' def clean(filepath, output_dir=nil) Abrizer::Cleaner.new(filepath, output_dir).clean