class MkvToolNix::Modules::MkvMerge
Attributes
default_language[RW]
disable_language_ietf[RW]
Public Class Methods
new(bin_path)
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 11 def initialize(bin_path) @bin_path = "#{bin_path}mkvmerge" @default_language = 'und' @disable_language_ietf = false end
Public Instance Methods
build_attachment(file)
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 60 def build_attachment(file) Types::Merge::Attachment.new(file) end
build_chapter()
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 64 def build_chapter Types::Merge::Chapter.new end
build_input_file(file)
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 76 def build_input_file(file) Types::Merge::InputFile.new(file) end
build_output_control()
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 72 def build_output_control Types::Merge::OutputControl.new end
build_segment_info()
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 56 def build_segment_info Types::Merge::SegmentInfo.new end
info(file)
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 46 def info(file) cmd = [@bin_path, '-J'] cmd << file result = call_cmd(cmd) json = JSON.parse(result.stdout) Types::Info::MkvContainer.create(json) end
merge(output_file, *input_files, attachments: nil, chapter_options: nil, tag_options: nil, output_control: nil, segment_info: nil)
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 25 def merge(output_file, *input_files, attachments: nil, chapter_options: nil, tag_options: nil, output_control: nil, segment_info: nil) raise Errors::MkvToolNixError, 'No Input File(s) given.' if input_files.nil? cmd = ['mkvmerge'] attachments&.each { |attachment| attachment.add_to_cmd(cmd) } chapter_options&.add_to_cmd(cmd) segment_info&.add_to_cmd(cmd) tag_options&.add_to_cmd(cmd) output_control&.add_to_cmd(cmd) cmd << '-o' << output_file input_files.each { |input| input.add_to_cmd(cmd) } a = cmd.join(' ') call_cmd(cmd) end
version()
click to toggle source
# File lib/mkvtoolnix/modules/mkvmerge.rb, line 17 def version cmd = [@bin_path, '-V'] result = call_cmd(cmd) result.stdout.strip end