dvdvrconv 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +13 -13
- data/.travis.yml +6 -6
- data/Gemfile +6 -6
- data/LICENSE.txt +21 -21
- data/Rakefile +11 -11
- data/bin/console +14 -14
- data/bin/setup +8 -8
- data/dvdvrconv.gemspec +26 -26
- data/exe/dvdvrconv +5 -5
- data/lib/dvdvrconv/command.rb +52 -24
- data/lib/dvdvrconv/dvdvr.rb +96 -50
- data/lib/dvdvrconv/options.rb +8 -6
- data/lib/dvdvrconv/version.rb +3 -1
- data/lib/dvdvrconv.rb +9 -7
- data/test-unit.yml +11 -11
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c05c88e2cd69df800f143dc2a9754a4f9b04ee5c64756fff8ed09faad6e2fc4f
|
4
|
+
data.tar.gz: d189810613ef0a7ff5b7e243fd0a10d258bce0486a82f81d83a68f2661ea777d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b2e0fb30eb6087997fc6faaf09c4ef6e5b7917cddbe4a9ea926adcf8d6c58b68029243bca095a3929cb56eb95cb98585b35eb9222693e3368e5e333e0c37e7fe
|
7
|
+
data.tar.gz: c0a664e7eb8a6689f6030a10a46de495c8da114c50beabbab085d3fa7d08d980048a11fe3d81410151e3fff91eff460a27d097b4cb64d0ad4bfb2a7c612addfb
|
data/.gitignore
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
/.bundle/
|
2
|
-
/.yardoc
|
3
|
-
/_yardoc/
|
4
|
-
/coverage/
|
5
|
-
/doc/
|
6
|
-
/pkg/
|
7
|
-
/spec/reports/
|
8
|
-
/tmp/
|
9
|
-
/Gemfile.lock
|
10
|
-
/.vscode/
|
11
|
-
/debug.log
|
12
|
-
/*.vob
|
13
|
-
/*.mp4
|
1
|
+
/.bundle/
|
2
|
+
/.yardoc
|
3
|
+
/_yardoc/
|
4
|
+
/coverage/
|
5
|
+
/doc/
|
6
|
+
/pkg/
|
7
|
+
/spec/reports/
|
8
|
+
/tmp/
|
9
|
+
/Gemfile.lock
|
10
|
+
/.vscode/
|
11
|
+
/debug.log
|
12
|
+
/*.vob
|
13
|
+
/*.mp4
|
data/.travis.yml
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
---
|
2
|
-
language: ruby
|
3
|
-
cache: bundler
|
4
|
-
rvm:
|
5
|
-
- 2.7.1
|
6
|
-
before_install: gem install bundler -v 2.1.4
|
1
|
+
---
|
2
|
+
language: ruby
|
3
|
+
cache: bundler
|
4
|
+
rvm:
|
5
|
+
- 2.7.1
|
6
|
+
before_install: gem install bundler -v 2.1.4
|
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in dvdvrconv.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem 'rake', '~> 12.0'
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# Specify your gem's dependencies in dvdvrconv.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'rake', '~> 12.0'
|
data/LICENSE.txt
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2020 icm7216
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2020 icm7216
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
require "bundler/gem_tasks"
|
2
|
-
require "rake/testtask"
|
3
|
-
|
4
|
-
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs << "test"
|
6
|
-
t.libs << "lib"
|
7
|
-
t.test_files = FileList["test/**/*_test.rb"]
|
8
|
-
t.options = "-v"
|
9
|
-
end
|
10
|
-
|
11
|
-
task :default => :test
|
1
|
+
require "bundler/gem_tasks"
|
2
|
+
require "rake/testtask"
|
3
|
+
|
4
|
+
Rake::TestTask.new(:test) do |t|
|
5
|
+
t.libs << "test"
|
6
|
+
t.libs << "lib"
|
7
|
+
t.test_files = FileList["test/**/*_test.rb"]
|
8
|
+
t.options = "-v"
|
9
|
+
end
|
10
|
+
|
11
|
+
task :default => :test
|
data/bin/console
CHANGED
@@ -1,14 +1,14 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "dvdvrconv"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "dvdvrconv"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
#!/usr/bin/env bash
|
2
|
-
set -euo pipefail
|
3
|
-
IFS=$'\n\t'
|
4
|
-
set -vx
|
5
|
-
|
6
|
-
bundle install
|
7
|
-
|
8
|
-
# Do any other automated setup that you need to do here
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
set -vx
|
5
|
+
|
6
|
+
bundle install
|
7
|
+
|
8
|
+
# Do any other automated setup that you need to do here
|
data/dvdvrconv.gemspec
CHANGED
@@ -1,26 +1,26 @@
|
|
1
|
-
require_relative "lib/dvdvrconv/version"
|
2
|
-
|
3
|
-
Gem::Specification.new do |spec|
|
4
|
-
spec.name = "dvdvrconv"
|
5
|
-
spec.version = Dvdvrconv::VERSION
|
6
|
-
spec.authors = ["icm7216"]
|
7
|
-
spec.email = ["icm7216d@gmail.com"]
|
8
|
-
|
9
|
-
spec.summary = %q{DVD-VR utility}
|
10
|
-
spec.description = %q{This tool converts "vro" file on DVD-VR format disc to "mp4" files.}
|
11
|
-
spec.homepage = "https://github.com/icm7216/dvdvrconv"
|
12
|
-
spec.license = "MIT"
|
13
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
14
|
-
|
15
|
-
# Specify which files should be added to the gem when it is released.
|
16
|
-
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
-
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
18
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
-
end
|
20
|
-
spec.bindir = "exe"
|
21
|
-
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
-
spec.require_paths = ["lib"]
|
23
|
-
|
24
|
-
spec.add_development_dependency "test-unit"
|
25
|
-
spec.add_development_dependency "test-unit-rr"
|
26
|
-
end
|
1
|
+
require_relative "lib/dvdvrconv/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "dvdvrconv"
|
5
|
+
spec.version = Dvdvrconv::VERSION
|
6
|
+
spec.authors = ["icm7216"]
|
7
|
+
spec.email = ["icm7216d@gmail.com"]
|
8
|
+
|
9
|
+
spec.summary = %q{DVD-VR utility}
|
10
|
+
spec.description = %q{This tool converts "vro" file on DVD-VR format disc to "mp4" files.}
|
11
|
+
spec.homepage = "https://github.com/icm7216/dvdvrconv"
|
12
|
+
spec.license = "MIT"
|
13
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.4.0")
|
14
|
+
|
15
|
+
# Specify which files should be added to the gem when it is released.
|
16
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
17
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
18
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
end
|
20
|
+
spec.bindir = "exe"
|
21
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
22
|
+
spec.require_paths = ["lib"]
|
23
|
+
|
24
|
+
spec.add_development_dependency "test-unit"
|
25
|
+
spec.add_development_dependency "test-unit-rr"
|
26
|
+
end
|
data/exe/dvdvrconv
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "dvdvrconv"
|
4
|
-
|
5
|
-
Dvdvrconv::Command.run(ARGV)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "dvdvrconv"
|
4
|
+
|
5
|
+
Dvdvrconv::Command.run(ARGV)
|
data/lib/dvdvrconv/command.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dvdvrconv
|
2
4
|
class Command
|
3
5
|
def self.run(argv)
|
@@ -54,22 +56,36 @@ module Dvdvrconv
|
|
54
56
|
dvd.vrdisc.concat_mode = @options[:concat_mode]
|
55
57
|
end
|
56
58
|
|
59
|
+
if @options[:hardware_encode].nil?
|
60
|
+
dvd.vrdisc.hardware_encode = DEFAULT_HARDWARE_ENCODE
|
61
|
+
else
|
62
|
+
dvd.vrdisc.hardware_encode = @options[:hardware_encode]
|
63
|
+
end
|
64
|
+
|
65
|
+
if @options[:global_quality].nil?
|
66
|
+
dvd.vrdisc.global_quality = Dvdvrconv::DEFAULT_GLOBAL_QUALITY
|
67
|
+
else
|
68
|
+
dvd.vrdisc.global_quality = @options[:global_quality]
|
69
|
+
end
|
70
|
+
|
57
71
|
# View the path of each files
|
58
|
-
puts
|
59
|
-
puts " => VR_MANGR.IFO:
|
60
|
-
puts " => VR_MOVIE.VRO
|
61
|
-
puts " => dvd-vr.exe:
|
62
|
-
puts
|
72
|
+
puts '== Use these paths =='
|
73
|
+
puts " => VR_MANGR.IFO: #{dvd.vrdisc.opts_ifo}"
|
74
|
+
puts " => VR_MOVIE.VRO: #{dvd.vrdisc.opts_vro}"
|
75
|
+
puts " => dvd-vr.exe: #{dvd.vrdisc.cmd}"
|
76
|
+
puts '== Customize settings =='
|
63
77
|
puts " => use_customize_title: #{@options[:use_customize_title]}"
|
64
|
-
puts " => base_dst_name:
|
65
|
-
puts " => number_list:
|
66
|
-
puts " => concat_mode:
|
78
|
+
puts " => base_dst_name: #{@options[:base_dst_name]}"
|
79
|
+
puts " => number_list: #{@options[:number_list]}"
|
80
|
+
puts " => concat_mode: #{@options[:concat_mode]}"
|
81
|
+
puts " => hardware_encode: #{@options[:hardware_encode]}"
|
82
|
+
puts " => global_quality: #{@options[:global_quality]}"
|
67
83
|
|
68
84
|
dvd.read_info
|
69
85
|
|
70
86
|
dvd.view_info if options[:opt][:info] || options[:opt].empty?
|
71
87
|
exit unless options[:opt][:exec]
|
72
|
-
|
88
|
+
|
73
89
|
# Extract vob files
|
74
90
|
dvd.adjust_title
|
75
91
|
dvd.vro2vob
|
@@ -80,7 +96,7 @@ module Dvdvrconv
|
|
80
96
|
|
81
97
|
# Concatenate Split titles
|
82
98
|
if dvd.vrdisc.concat_mode == true
|
83
|
-
puts
|
99
|
+
puts '== Concatenate Split titles =='
|
84
100
|
concat_list = dvd.make_concat_list
|
85
101
|
dvd.concat_titles(concat_list)
|
86
102
|
end
|
@@ -88,7 +104,7 @@ module Dvdvrconv
|
|
88
104
|
# customize title of vob files
|
89
105
|
case @options[:use_customize_title]
|
90
106
|
when 1
|
91
|
-
puts
|
107
|
+
puts 'Specify individual file names.'
|
92
108
|
|
93
109
|
if @options[:base_dst_name].class == Array
|
94
110
|
base_dst_name = @options[:base_dst_name]
|
@@ -99,7 +115,7 @@ module Dvdvrconv
|
|
99
115
|
|
100
116
|
number_list = []
|
101
117
|
when 2
|
102
|
-
puts
|
118
|
+
puts 'Add sequence number to the file name.'
|
103
119
|
|
104
120
|
if @options[:base_dst_name].class == String
|
105
121
|
base_dst_name = @options[:base_dst_name]
|
@@ -110,7 +126,7 @@ module Dvdvrconv
|
|
110
126
|
|
111
127
|
number_list = []
|
112
128
|
when 3
|
113
|
-
puts
|
129
|
+
puts 'Specify sequence numbers individually.'
|
114
130
|
|
115
131
|
if @options[:base_dst_name].class == String
|
116
132
|
base_dst_name = @options[:base_dst_name]
|
@@ -122,13 +138,13 @@ module Dvdvrconv
|
|
122
138
|
if @options[:number_list].class == Array
|
123
139
|
number_list = @options[:number_list]
|
124
140
|
else
|
125
|
-
puts
|
141
|
+
puts 'ERROR: number_list should be an Array.'
|
126
142
|
exit
|
127
143
|
end
|
128
144
|
|
129
145
|
else
|
130
|
-
puts
|
131
|
-
base_dst_name = dvd.vrdisc.title.uniq.map { |file| file[0].gsub(/\s/,
|
146
|
+
puts 'No customize file names'
|
147
|
+
base_dst_name = dvd.vrdisc.title.uniq.map { |file| file[0].gsub(/\s/, '_') }
|
132
148
|
number_list = []
|
133
149
|
end
|
134
150
|
|
@@ -141,9 +157,9 @@ module Dvdvrconv
|
|
141
157
|
|
142
158
|
# load yaml file and store in @options.
|
143
159
|
def load_config(file)
|
144
|
-
config = YAML.
|
160
|
+
config = YAML.safe_load(File.read(file)) || {}
|
145
161
|
|
146
|
-
%w
|
162
|
+
%w[vr_mangr_ifo vr_movie_vro dvd_vr_cmd].each do |key|
|
147
163
|
@options[key.to_sym] = nil
|
148
164
|
|
149
165
|
unless config.key?(key)
|
@@ -158,14 +174,26 @@ module Dvdvrconv
|
|
158
174
|
|
159
175
|
end
|
160
176
|
|
161
|
-
@options[:use_customize_title] = config[
|
162
|
-
@options[:base_dst_name] = config[
|
163
|
-
@options[:number_list] = config[
|
177
|
+
@options[:use_customize_title] = config['use_customize_title'] || 'no'
|
178
|
+
@options[:base_dst_name] = config['base_dst_name'] || []
|
179
|
+
@options[:number_list] = config['number_list'] || []
|
164
180
|
|
165
|
-
if config[
|
181
|
+
if config['concat_mode'].nil?
|
166
182
|
@options[:concat_mode] = Dvdvrconv::DEFAULT_CONCAT_MODE
|
167
183
|
else
|
168
|
-
@options[:concat_mode] = config[
|
184
|
+
@options[:concat_mode] = config['concat_mode']
|
185
|
+
end
|
186
|
+
|
187
|
+
if config['hardware_encode'].nil?
|
188
|
+
@options[:hardware_encode] = 'normal'
|
189
|
+
else
|
190
|
+
@options[:hardware_encode] = config['hardware_encode']
|
191
|
+
end
|
192
|
+
|
193
|
+
if config['global_quality'].nil?
|
194
|
+
@options[:global_quality] = Dvdvrconv::DEFAULT_GLOBAL_QUALITY
|
195
|
+
else
|
196
|
+
@options[:global_quality] = config['global_quality']
|
169
197
|
end
|
170
198
|
end
|
171
199
|
|
@@ -174,7 +202,7 @@ module Dvdvrconv
|
|
174
202
|
:vr_mangr_ifo => @options[:vr_mangr_ifo],
|
175
203
|
:vr_movie_vro => @options[:vr_movie_vro],
|
176
204
|
:dvd_vr_cmd => @options[:dvd_vr_cmd]
|
177
|
-
}
|
205
|
+
}
|
178
206
|
end
|
179
207
|
end
|
180
208
|
end
|
data/lib/dvdvrconv/dvdvr.rb
CHANGED
@@ -1,36 +1,42 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dvdvrconv
|
2
4
|
|
3
5
|
# DVD-VR disc status
|
4
6
|
Vrdisc = Struct.new(
|
5
|
-
:header,
|
6
|
-
:num,
|
7
|
-
:title,
|
8
|
-
:date,
|
9
|
-
:size,
|
10
|
-
:opts_ifo,
|
11
|
-
:opts_vro,
|
12
|
-
:cmd,
|
13
|
-
:output_title,
|
14
|
-
:duplicate_name,
|
15
|
-
:vob_titles,
|
16
|
-
:default_opts_ifo
|
17
|
-
:default_opts_vro
|
18
|
-
:default_cmd,
|
19
|
-
:concat_mode,
|
7
|
+
:header, # @param [String]
|
8
|
+
:num, # @param [Array<String>]
|
9
|
+
:title, # @param [Array<String>]
|
10
|
+
:date, # @param [Array<String>]
|
11
|
+
:size, # @param [Array<String>]
|
12
|
+
:opts_ifo, # @param [String]
|
13
|
+
:opts_vro, # @param [String]
|
14
|
+
:cmd, # @param [String]
|
15
|
+
:output_title, # @param [Array<String>]
|
16
|
+
:duplicate_name, # @param [Array<String>]
|
17
|
+
:vob_titles, # @param [Array<String>]
|
18
|
+
:default_opts_ifo, # @param [String]
|
19
|
+
:default_opts_vro, # @param [String]
|
20
|
+
:default_cmd, # @param [String]
|
21
|
+
:concat_mode, # @param [Boolean]
|
22
|
+
:hardware_encode, # @param [String]
|
23
|
+
:global_quality # @param [Integer]
|
20
24
|
)
|
21
25
|
|
22
|
-
BASE_NAME =
|
23
|
-
DEFAULT_CONFIG_FILE =
|
26
|
+
BASE_NAME = 'DVD'
|
27
|
+
DEFAULT_CONFIG_FILE = 'default_dvdvrconv.yml'
|
24
28
|
DEFAULT_CONCAT_MODE = true
|
29
|
+
DEFAULT_HARDWARE_ENCODE = 'normal'
|
30
|
+
DEFAULT_GLOBAL_QUALITY = 25
|
25
31
|
|
26
32
|
# Default DVD drive is "d".
|
27
33
|
# If you want to use a different drive, you need to set up a "default_dvdvrconv.yml" file.
|
28
|
-
WIN_DRV_IFO =
|
29
|
-
WIN_DRV_VRO =
|
30
|
-
WIN_DRV_CMD = File.expand_path(
|
31
|
-
DRV_IFO =
|
32
|
-
DRV_VRO =
|
33
|
-
DRV_CMD =
|
34
|
+
WIN_DRV_IFO = '/cygdrive/D/DVD_RTAV/VR_MANGR.IFO'
|
35
|
+
WIN_DRV_VRO = '/cygdrive/D/DVD_RTAV/VR_MOVIE.VRO'
|
36
|
+
WIN_DRV_CMD = File.expand_path('../../win/dvd-vr.exe', __dir__)
|
37
|
+
DRV_IFO = '/mnt/d/DVD_RTAV/VR_MANGR.IFO'
|
38
|
+
DRV_VRO = '/mnt/d/DVD_RTAV/VR_MOVIE.VRO'
|
39
|
+
DRV_CMD = 'dvd-vr'
|
34
40
|
|
35
41
|
class Dvdvr
|
36
42
|
attr_accessor :vrdisc
|
@@ -52,23 +58,63 @@ module Dvdvrconv
|
|
52
58
|
@vrdisc.default_opts_vro = @vrdisc.opts_vro
|
53
59
|
@vrdisc.default_cmd = @vrdisc.cmd
|
54
60
|
@vrdisc.concat_mode = Dvdvrconv::DEFAULT_CONCAT_MODE
|
61
|
+
@vrdisc.hardware_encode = Dvdvrconv::DEFAULT_HARDWARE_ENCODE
|
62
|
+
@vrdisc.global_quality = Dvdvrconv::DEFAULT_GLOBAL_QUALITY
|
55
63
|
end
|
56
64
|
|
57
65
|
# Read VRO file from dvd-ram disc in dvd-vr format, and output vob files.
|
58
66
|
def str_dvdvr_cmd
|
59
|
-
%
|
67
|
+
%(#{@vrdisc.cmd} --name=#{Dvdvrconv::BASE_NAME} #{@vrdisc.opts_ifo} #{@vrdisc.opts_vro})
|
60
68
|
end
|
61
69
|
|
62
70
|
# Make a concatenation command string for FFmpeg.
|
63
71
|
def str_concat_cmd(file_name, base_name)
|
64
|
-
%
|
72
|
+
%(ffmpeg -f concat -safe 0 -i #{file_name} -c copy #{base_name}.vob)
|
73
|
+
end
|
74
|
+
|
75
|
+
# File convert command, vob to mp4 for FFmpeg.
|
76
|
+
# * Change the aspect ratio to 16:9.
|
77
|
+
# * Delete a closed caption.
|
78
|
+
def ffmeg_normal_cmd(file_name)
|
79
|
+
cmd = 'ffmpeg '
|
80
|
+
cmd += "-i #{file_name}.vob "
|
81
|
+
cmd += '-filter:v "crop=704:474:0:0" '
|
82
|
+
cmd += '-vcodec libx264 '
|
83
|
+
cmd += '-b:v 500k '
|
84
|
+
cmd += '-aspect 16:9 '
|
85
|
+
cmd += '-acodec copy '
|
86
|
+
cmd += '-bsf:v "filter_units=remove_types=6" '
|
87
|
+
cmd + "#{file_name}.mp4"
|
65
88
|
end
|
66
89
|
|
67
90
|
# File convert command, vob to mp4 for FFmpeg.
|
91
|
+
# * FFmpeg with QSV(Intel Quick Sync Video)
|
68
92
|
# * Change the aspect ratio to 16:9.
|
69
93
|
# * Delete a closed caption.
|
94
|
+
def ffmpeg_qsv_cmd(file_name)
|
95
|
+
cmd = 'ffmpeg '
|
96
|
+
cmd += '-hwaccel qsv '
|
97
|
+
cmd += '-hwaccel_output_format qsv '
|
98
|
+
cmd += "-i #{file_name}.vob "
|
99
|
+
cmd += '-filter:v "crop=704:474:0:0" '
|
100
|
+
cmd += '-c:v h264_qsv '
|
101
|
+
cmd += "-global_quality #{@vrdisc.global_quality} "
|
102
|
+
cmd += '-look_ahead 1 '
|
103
|
+
cmd += '-aspect 16:9 '
|
104
|
+
cmd += '-acodec copy '
|
105
|
+
cmd += '-bsf:v "filter_units=remove_types=6" '
|
106
|
+
cmd + "#{file_name}.mp4"
|
107
|
+
end
|
108
|
+
|
109
|
+
# File convert command, vob to mp4 for FFmpeg.
|
70
110
|
def str_convert_cmd(file_name)
|
71
|
-
|
111
|
+
if @vrdisc.hardware_encode == 'qsv'
|
112
|
+
ffmpeg_qsv_cmd(file_name)
|
113
|
+
elsif @vrdisc.hardware_encode == 'normal'
|
114
|
+
ffmeg_normal_cmd(file_name)
|
115
|
+
else
|
116
|
+
ffmeg_normal_cmd(file_name)
|
117
|
+
end
|
72
118
|
end
|
73
119
|
|
74
120
|
# Read video information from dvd-ram discs in dvd-vr format.
|
@@ -89,7 +135,7 @@ module Dvdvrconv
|
|
89
135
|
@vrdisc.header = out.scan(/^(.*?)Number/m)
|
90
136
|
|
91
137
|
# Sets the captured information to @vrdisc.
|
92
|
-
%w
|
138
|
+
%w[num title date size].each do |item|
|
93
139
|
str = format("%-5s", item) + ":"
|
94
140
|
@vrdisc[item] = out.scan(/#{str}\s(.*?)$/)
|
95
141
|
end
|
@@ -104,14 +150,14 @@ module Dvdvrconv
|
|
104
150
|
# @vrdisc.date, @vrdisc.size
|
105
151
|
#
|
106
152
|
def view_info
|
107
|
-
puts
|
153
|
+
puts '----- view dvd-vr info -----'
|
108
154
|
puts @vrdisc.header
|
109
155
|
[@vrdisc.num, @vrdisc.title, @vrdisc.date, @vrdisc.size].transpose.each do |x|
|
110
|
-
%w
|
111
|
-
line = format(
|
156
|
+
%w[num title date size].each_with_index do |item, idx|
|
157
|
+
line = format('%-5s', item) + ": #{x.flatten[idx]}\n"
|
112
158
|
puts line
|
113
159
|
end
|
114
|
-
puts
|
160
|
+
puts '-'
|
115
161
|
end
|
116
162
|
end
|
117
163
|
|
@@ -140,10 +186,10 @@ module Dvdvrconv
|
|
140
186
|
# Add sequential numbers to duplicate name.
|
141
187
|
if dup.include?(@vrdisc.title[idx])
|
142
188
|
dup_counter += 1
|
143
|
-
output_title << format(
|
189
|
+
output_title << format('%s_%02d', new_name, dup_counter)
|
144
190
|
duplicate_names << new_name
|
145
191
|
else
|
146
|
-
output_title << format(
|
192
|
+
output_title << format('%s', new_name)
|
147
193
|
end
|
148
194
|
dup_counter = 0 if dup_counter == @vrdisc.title.count(@vrdisc.title[idx])
|
149
195
|
end
|
@@ -158,10 +204,10 @@ module Dvdvrconv
|
|
158
204
|
# Read VRO file from dvd-ram disc in dvd-vr format, and output vob files.
|
159
205
|
def vro2vob
|
160
206
|
cmd = str_dvdvr_cmd
|
161
|
-
puts
|
207
|
+
puts '----- convert file VRO to VOB -----'
|
162
208
|
puts "> cmd:\n #{cmd}"
|
163
209
|
system(cmd)
|
164
|
-
puts
|
210
|
+
puts ''
|
165
211
|
end
|
166
212
|
|
167
213
|
# Change the file name to the title name
|
@@ -176,8 +222,8 @@ module Dvdvrconv
|
|
176
222
|
vob_titles = []
|
177
223
|
|
178
224
|
@vrdisc.title.size.times do |x|
|
179
|
-
src = format(
|
180
|
-
dst = @vrdisc.output_title[x] +
|
225
|
+
src = format('%s#%03d', Dvdvrconv::BASE_NAME, x + 1) + '.vob'
|
226
|
+
dst = @vrdisc.output_title[x] + '.vob'
|
181
227
|
vob_titles << [src, dst]
|
182
228
|
end
|
183
229
|
|
@@ -221,26 +267,26 @@ module Dvdvrconv
|
|
221
267
|
titels = @vrdisc.output_title
|
222
268
|
end
|
223
269
|
|
224
|
-
titels.each_with_index do |title, idx|
|
225
|
-
src = title.gsub(/\s/,
|
270
|
+
titels.each_with_index do |title, idx|
|
271
|
+
src = title.gsub(/\s/, '_') + '.vob'
|
226
272
|
|
227
273
|
case base_dst_name
|
228
274
|
when Array
|
229
275
|
dst_name = base_dst_name[idx]
|
230
276
|
when String
|
231
277
|
if number_list.size.zero?
|
232
|
-
dst_name = base_dst_name + format(
|
278
|
+
dst_name = base_dst_name + format('_%02d', idx + 1)
|
233
279
|
else
|
234
280
|
case number_list[idx]
|
235
281
|
when Numeric
|
236
|
-
dst_name = base_dst_name + format(
|
282
|
+
dst_name = base_dst_name + format('_%02d', number_list[idx])
|
237
283
|
when String
|
238
|
-
dst_name = base_dst_name + format(
|
284
|
+
dst_name = base_dst_name + format('_%s', number_list[idx])
|
239
285
|
end
|
240
286
|
end
|
241
287
|
end
|
242
288
|
|
243
|
-
dst = dst_name +
|
289
|
+
dst = dst_name + '.vob'
|
244
290
|
vob_titles << [src, dst]
|
245
291
|
end
|
246
292
|
|
@@ -256,7 +302,7 @@ module Dvdvrconv
|
|
256
302
|
# @vrdisc.vob_titles
|
257
303
|
#
|
258
304
|
def rename_vob
|
259
|
-
puts
|
305
|
+
puts '----- output vob file -----'
|
260
306
|
|
261
307
|
@vrdisc.vob_titles.each do |file_title|
|
262
308
|
src, dst = file_title
|
@@ -279,11 +325,11 @@ module Dvdvrconv
|
|
279
325
|
concat_list = []
|
280
326
|
|
281
327
|
@vrdisc.duplicate_name.each do |base_name|
|
282
|
-
contents =
|
328
|
+
contents = ''
|
283
329
|
file_name = "concat_#{base_name}.txt"
|
284
330
|
|
285
331
|
names = @vrdisc.output_title.select { |x| x.match(/#{base_name}_\d\d/) }
|
286
|
-
names.each { |line| contents +=
|
332
|
+
names.each { |line| contents += "file '#{line}.vob'\n" }
|
287
333
|
concat_list << [file_name, contents, base_name]
|
288
334
|
end
|
289
335
|
|
@@ -305,14 +351,14 @@ module Dvdvrconv
|
|
305
351
|
# @param [String] base_name output vob name.
|
306
352
|
#
|
307
353
|
def concat_titles(concat_list)
|
308
|
-
puts
|
354
|
+
puts '----- Concatenate Split Titles -----'
|
309
355
|
concat_list.each do |list|
|
310
356
|
file_name, contents, base_name = list
|
311
357
|
File.write(file_name, contents)
|
312
358
|
puts "concat list= #{file_name}"
|
313
359
|
|
314
360
|
cmd = str_concat_cmd(file_name, base_name)
|
315
|
-
puts
|
361
|
+
puts '----- concat vob files -----'
|
316
362
|
puts "run cmd:\n #{cmd}"
|
317
363
|
system(cmd)
|
318
364
|
|
@@ -326,7 +372,7 @@ module Dvdvrconv
|
|
326
372
|
|
327
373
|
def vrdisc_status
|
328
374
|
puts "\n< < < < < @vrdisc status > > > > >"
|
329
|
-
%w
|
375
|
+
%w[num title output_title duplicate_name vob_titles concat_mode hardware_encode global_quality].each do |item|
|
330
376
|
puts "#{item}=> #{@vrdisc[item]}"
|
331
377
|
end
|
332
378
|
puts "< < < < < @vrdisc status > > > > >\n"
|
@@ -341,7 +387,7 @@ module Dvdvrconv
|
|
341
387
|
files = []
|
342
388
|
|
343
389
|
@vrdisc.vob_titles.each do |vob_title|
|
344
|
-
files << vob_title[1].gsub(/.vob/,
|
390
|
+
files << vob_title[1].gsub(/.vob/, '')
|
345
391
|
end
|
346
392
|
|
347
393
|
files.each do |file_name|
|
data/lib/dvdvrconv/options.rb
CHANGED
@@ -1,36 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Dvdvrconv
|
2
4
|
module Options
|
3
5
|
def self.parse(argv)
|
4
6
|
options = {}
|
5
7
|
|
6
8
|
parser = OptionParser.new do |o|
|
7
|
-
o.on_head(
|
9
|
+
o.on_head('-v', '--version', 'Show version') do |v|
|
8
10
|
options[:version] = v
|
9
11
|
o.version = Dvdvrconv::VERSION
|
10
12
|
puts o.version
|
11
13
|
exit
|
12
14
|
end
|
13
15
|
|
14
|
-
o.on(
|
16
|
+
o.on('-i', '--info', 'Show file information') do |v|
|
15
17
|
options[:info] = v
|
16
18
|
end
|
17
19
|
|
18
|
-
o.on(
|
20
|
+
o.on('-c', '--config=FILE', String, 'Use YAML format FILE.') do |file|
|
19
21
|
options[:config_file] = file
|
20
22
|
end
|
21
23
|
|
22
|
-
o.on(
|
24
|
+
o.on('-e', '--exec', 'Execute the VRO file to mp4 conversion.') do |v|
|
23
25
|
options[:exec] = v
|
24
26
|
end
|
25
27
|
end
|
26
28
|
|
27
29
|
begin
|
28
|
-
|
30
|
+
parser.parse!(argv)
|
29
31
|
rescue OptionParser::InvalidArgument => e
|
30
32
|
abort e.message
|
31
33
|
rescue OptionParser::MissingArgument => e
|
32
34
|
case e.args
|
33
|
-
when [
|
35
|
+
when ['-c'], ['--config']
|
34
36
|
# load_config(Dvdvrconv::DEFAULT_CONFIG_FILE)
|
35
37
|
puts "The config file has not been specified.\nUse the default configuration file. (=> #{Dvdvrconv::DEFAULT_CONFIG_FILE})"
|
36
38
|
options[:config_file] = Dvdvrconv::DEFAULT_CONFIG_FILE
|
data/lib/dvdvrconv/version.rb
CHANGED
data/lib/dvdvrconv.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
|
-
|
2
|
-
require "optparse"
|
3
|
-
require "yaml"
|
1
|
+
# frozen_string_literal: true
|
4
2
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
3
|
+
require 'open3'
|
4
|
+
require 'optparse'
|
5
|
+
require 'yaml'
|
6
|
+
|
7
|
+
require_relative 'dvdvrconv/command'
|
8
|
+
require_relative 'dvdvrconv/options'
|
9
|
+
require_relative 'dvdvrconv/dvdvr'
|
10
|
+
require_relative 'dvdvrconv/version'
|
data/test-unit.yml
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
runner: console
|
2
|
-
console_options:
|
3
|
-
color_scheme: normal
|
4
|
-
color_schemes:
|
5
|
-
normal:
|
6
|
-
success:
|
7
|
-
name: green
|
8
|
-
bold: true
|
9
|
-
failure:
|
10
|
-
name: red
|
11
|
-
bold: true
|
1
|
+
runner: console
|
2
|
+
console_options:
|
3
|
+
color_scheme: normal
|
4
|
+
color_schemes:
|
5
|
+
normal:
|
6
|
+
success:
|
7
|
+
name: green
|
8
|
+
bold: true
|
9
|
+
failure:
|
10
|
+
name: red
|
11
|
+
bold: true
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dvdvrconv
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- icm7216
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: test-unit
|
@@ -71,7 +70,6 @@ homepage: https://github.com/icm7216/dvdvrconv
|
|
71
70
|
licenses:
|
72
71
|
- MIT
|
73
72
|
metadata: {}
|
74
|
-
post_install_message:
|
75
73
|
rdoc_options: []
|
76
74
|
require_paths:
|
77
75
|
- lib
|
@@ -86,8 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
86
84
|
- !ruby/object:Gem::Version
|
87
85
|
version: '0'
|
88
86
|
requirements: []
|
89
|
-
rubygems_version: 3.
|
90
|
-
signing_key:
|
87
|
+
rubygems_version: 3.6.8
|
91
88
|
specification_version: 4
|
92
89
|
summary: DVD-VR utility
|
93
90
|
test_files: []
|