Class: Abrizer::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/abrizer/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.add_shared_option(name, option_name, options = {}) ⇒ Object



13
14
15
16
# File 'lib/abrizer/cli.rb', line 13

def add_shared_option(name, option_name, options = {})
  @shared_options = {} if @shared_options.nil?
  @shared_options[name] = [option_name, options]
end

.input_bannerObject



26
27
28
# File 'lib/abrizer/cli.rb', line 26

def input_banner
  'INPUT_FILEPATH'
end

.input_descObject



30
31
32
# File 'lib/abrizer/cli.rb', line 30

def input_desc
  'Full or relative path to a mezzanine video file.'
end

.shared_options(*names) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/abrizer/cli.rb', line 18

def shared_options(*names)
  names.each do |name|
    opt =  @shared_options[name]
    raise "Tried to access shared option '#{option_name}' but it was not previously defined" if opt.nil?
    method_option *opt
  end
end

Instance Method Details

#abrObject



123
124
125
126
127
128
129
# File 'lib/abrizer/cli.rb', line 123

def abr
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::Processor.process(filepath, output_dir)
  Abrizer::PackageDashBento.new(filepath, output_dir).package
  Abrizer::PackageHlsBento.new(filepath, output_dir).package
end

#adaptationsObject



65
66
67
68
69
70
# File 'lib/abrizer/cli.rb', line 65

def adaptations
  input = expand_path options[:input]
  output = expand_path options[:output]
  adaptations = Abrizer::AdaptationsFile.new(input, output).adaptations
  puts adaptations
end

#allObject



49
50
51
52
53
# File 'lib/abrizer/cli.rb', line 49

def all
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::All.new(filepath, output_dir, options[:url], options[:vp9]).run
end

#canvasObject



165
166
167
168
169
# File 'lib/abrizer/cli.rb', line 165

def canvas
  filepath = expand_path options[:input]
  output_directory = expand_path options[:output]
  Abrizer::Canvas.new(filepath, output_directory, options[:url]).create
end

#captionsObject



84
85
86
87
88
# File 'lib/abrizer/cli.rb', line 84

def captions
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::Captions.new(filepath, output_dir).copy
end

#cleanObject



181
182
183
184
# File 'lib/abrizer/cli.rb', line 181

def clean
  output_dir = expand_path options[:output]
  Abrizer::Cleaner.new(output_dir).clean
end

#dataObject



173
174
175
176
177
# File 'lib/abrizer/cli.rb', line 173

def data
  filepath = expand_path options[:input]
  output_directory = expand_path options[:output]
  Abrizer::Data.new(filepath, output_directory, options[:url]).create
end

#ffprobeObject



57
58
59
60
61
# File 'lib/abrizer/cli.rb', line 57

def ffprobe
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::FfprobeFile.new(filepath, output_dir).run
end

#informObject



74
75
76
77
78
79
# File 'lib/abrizer/cli.rb', line 74

def inform
  input = expand_path options[:input]
  informer = FfprobeInformer.new(filepath: input)
  puts informer.json_result
  puts informer
end

#mp3Object



100
101
102
103
104
# File 'lib/abrizer/cli.rb', line 100

def mp3
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::ProgressiveMp3.new(filepath, output_dir).create
end

#mp4Object



141
142
143
144
# File 'lib/abrizer/cli.rb', line 141

def mp4
  output_dir = expand_path options[:output]
  Abrizer::ProgressiveMp4.new(output_dir).create
end

#package(dash_or_hls) ⇒ Object



148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/abrizer/cli.rb', line 148

def package(dash_or_hls)
  output_dir = expand_path options[:output]
  case dash_or_hls
  when "dash"
    Abrizer::PackageDashBento.new(output_dir).package
  when "hls"
    Abrizer::PackageHlsBento.new(output_dir).package
  when "all"
    Abrizer::PackageDashBento.new(output_dir).package
    Abrizer::PackageHlsBento.new(output_dir).package
  else
    puts "Not a valid packaging value. Try dash or hls."
  end
end

#posterObject



116
117
118
119
# File 'lib/abrizer/cli.rb', line 116

def poster
  output_dir = expand_path options[:output]
  Abrizer::TemporaryPoster.new(output_dir).copy
end

#processObject



133
134
135
136
137
# File 'lib/abrizer/cli.rb', line 133

def process
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::Processor.process(filepath, output_dir)
end

#spritesObject



108
109
110
111
112
# File 'lib/abrizer/cli.rb', line 108

def sprites
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::Sprites.new(filepath, output_dir).create
end

#vp9Object



92
93
94
95
96
# File 'lib/abrizer/cli.rb', line 92

def vp9
  filepath = expand_path options[:input]
  output_dir = expand_path options[:output]
  Abrizer::ProgressiveVp9.new(filepath, output_dir).create
end