-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmtxlib.rb
34 lines (26 loc) · 848 Bytes
/
mtxlib.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env ruby
# frozen_string_literal: true
# version 2019-01-24-01
require 'json'
require 'tempfile'
def identify_file(file_name)
Tempfile.create(%w[mkvmerge-arguments .json], nil, encoding: 'utf-8') do |file|
file.puts JSON.dump(['--identification-format', 'json', '--identify', file_name])
file.close
return JSON.parse(`mkvmerge @#{file.path}`)
end
end
def multiplex_file(arguments)
Tempfile.create(%w[mkvmerge-arguments .json], nil, encoding: 'utf-8') do |file|
file.puts JSON.dump(arguments)
file.close
system "mkvmerge @#{file.path}"
end
end
def edit_file_properties(arguments)
Tempfile.create(%w[mkvpropedit-arguments .json], nil, encoding: 'utf-8') do |file|
file.puts JSON.dump(arguments)
file.close
system "mkvpropedit @#{file.path}"
end
end