Class: EhbrsRubyUtils::Videos::ConvertJob

Inherits:
Object
  • Object
show all
Defined in:
lib/ehbrs_ruby_utils/videos/convert_job.rb

Constant Summary collapse

FORMATS_TO_EXTENSIONS =
{
  'matroska' => '.mkv',
  'mp4' => '.mp4'
}.freeze

Instance Method Summary collapse

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
# File 'lib/ehbrs_ruby_utils/videos/convert_job.rb', line 22

def run
  if converted.exist?
    warn("Converted file already exist: \"#{converted}\"")
  else
    convert
    swap
  end
end

#targetObject



31
32
33
# File 'lib/ehbrs_ruby_utils/videos/convert_job.rb', line 31

def target
  input.dirname.join("#{input.basename('.*')}#{target_extension}")
end