Class: MkvToolNix::Modules::MkvMerge
- Inherits:
-
Object
- Object
- MkvToolNix::Modules::MkvMerge
- Includes:
- MkvModule
- Defined in:
- lib/mkvtoolnix/modules/mkvmerge.rb
Overview
Instance Attribute Summary collapse
-
#default_language ⇒ Object
Returns the value of attribute default_language.
-
#disable_language_ietf ⇒ Object
Returns the value of attribute disable_language_ietf.
Instance Method Summary collapse
- #build_attachment(file) ⇒ Object
- #build_chapter ⇒ Object
- #build_input_file(file) ⇒ Object
- #build_output_control ⇒ Object
- #build_segment_info ⇒ Object
- #build_tags(file) ⇒ Object
- #info(file) ⇒ Object
-
#initialize(bin_path) ⇒ MkvMerge
constructor
A new instance of MkvMerge.
- #merge(output_file, *input_files, attachments: nil, chapter_options: nil, tag_options: nil, output_control: nil, segment_info: nil) ⇒ Object
- #version ⇒ Object
Methods included from MkvModule
Constructor Details
#initialize(bin_path) ⇒ MkvMerge
Returns a new instance of MkvMerge.
11 12 13 14 15 |
# 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 |
Instance Attribute Details
#default_language ⇒ Object
Returns the value of attribute default_language.
9 10 11 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 9 def default_language @default_language end |
#disable_language_ietf ⇒ Object
Returns the value of attribute disable_language_ietf.
9 10 11 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 9 def disable_language_ietf @disable_language_ietf end |
Instance Method Details
#build_attachment(file) ⇒ Object
60 61 62 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 60 def (file) Types::Merge::Attachment.new(file) end |
#build_chapter ⇒ Object
64 65 66 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 64 def build_chapter Types::Merge::Chapter.new end |
#build_input_file(file) ⇒ Object
76 77 78 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 76 def build_input_file(file) Types::Merge::InputFile.new(file) end |
#build_output_control ⇒ Object
72 73 74 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 72 def build_output_control Types::Merge::OutputControl.new end |
#build_segment_info ⇒ Object
56 57 58 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 56 def build_segment_info Types::Merge::SegmentInfo.new end |
#build_tags(file) ⇒ Object
68 69 70 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 68 def (file) Types::Merge::Tags.new(file) end |
#info(file) ⇒ Object
46 47 48 49 50 51 52 53 54 |
# 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) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# 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'] &.each { || .add_to_cmd(cmd) } &.add_to_cmd(cmd) segment_info&.add_to_cmd(cmd) &.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 ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/mkvtoolnix/modules/mkvmerge.rb', line 17 def version cmd = [@bin_path, '-V'] result = call_cmd(cmd) result.stdout.strip end |