dvdvrconv 1.2.0 → 1.3.0
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 +39 -24
- data/lib/dvdvrconv/dvdvr.rb +93 -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: 74bc4490abb3e80d289162b91a05912e2075421531f888205f10051a7930c22d
|
4
|
+
data.tar.gz: fa54458ff8f4bb490aaaaa0bb87e5690831b28ed198ef1538df385d51528323c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 94ae2207fdf720be7625ba638c2a1a800f43ece291a0129fec40acb7746c1a8619cf438909aba2c67f8d81d4cc7bbfc60071c6e075131d72c71b4b9e4ab29b38
|
7
|
+
data.tar.gz: 0fbe5892000ca58a9a977d9637cd03ad3ce6106424027c6e54397142ddf3b3ab917e5102b3ef221d5b4d1aa3c1681ad77f9ab415c688f31e05cedde5fdc99eaf
|
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,29 @@ 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
|
+
|
57
65
|
# 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
|
66
|
+
puts '== Use these paths =='
|
67
|
+
puts " => VR_MANGR.IFO: #{dvd.vrdisc.opts_ifo}"
|
68
|
+
puts " => VR_MOVIE.VRO: #{dvd.vrdisc.opts_vro}"
|
69
|
+
puts " => dvd-vr.exe: #{dvd.vrdisc.cmd}"
|
70
|
+
puts '== Customize settings =='
|
63
71
|
puts " => use_customize_title: #{@options[:use_customize_title]}"
|
64
|
-
puts " => base_dst_name:
|
65
|
-
puts " => number_list:
|
66
|
-
puts " => concat_mode:
|
72
|
+
puts " => base_dst_name: #{@options[:base_dst_name]}"
|
73
|
+
puts " => number_list: #{@options[:number_list]}"
|
74
|
+
puts " => concat_mode: #{@options[:concat_mode]}"
|
75
|
+
puts " => hardware_encode: #{@options[:hardware_encode]}"
|
67
76
|
|
68
77
|
dvd.read_info
|
69
78
|
|
70
79
|
dvd.view_info if options[:opt][:info] || options[:opt].empty?
|
71
80
|
exit unless options[:opt][:exec]
|
72
|
-
|
81
|
+
|
73
82
|
# Extract vob files
|
74
83
|
dvd.adjust_title
|
75
84
|
dvd.vro2vob
|
@@ -80,7 +89,7 @@ module Dvdvrconv
|
|
80
89
|
|
81
90
|
# Concatenate Split titles
|
82
91
|
if dvd.vrdisc.concat_mode == true
|
83
|
-
puts
|
92
|
+
puts '== Concatenate Split titles =='
|
84
93
|
concat_list = dvd.make_concat_list
|
85
94
|
dvd.concat_titles(concat_list)
|
86
95
|
end
|
@@ -88,7 +97,7 @@ module Dvdvrconv
|
|
88
97
|
# customize title of vob files
|
89
98
|
case @options[:use_customize_title]
|
90
99
|
when 1
|
91
|
-
puts
|
100
|
+
puts 'Specify individual file names.'
|
92
101
|
|
93
102
|
if @options[:base_dst_name].class == Array
|
94
103
|
base_dst_name = @options[:base_dst_name]
|
@@ -99,7 +108,7 @@ module Dvdvrconv
|
|
99
108
|
|
100
109
|
number_list = []
|
101
110
|
when 2
|
102
|
-
puts
|
111
|
+
puts 'Add sequence number to the file name.'
|
103
112
|
|
104
113
|
if @options[:base_dst_name].class == String
|
105
114
|
base_dst_name = @options[:base_dst_name]
|
@@ -110,7 +119,7 @@ module Dvdvrconv
|
|
110
119
|
|
111
120
|
number_list = []
|
112
121
|
when 3
|
113
|
-
puts
|
122
|
+
puts 'Specify sequence numbers individually.'
|
114
123
|
|
115
124
|
if @options[:base_dst_name].class == String
|
116
125
|
base_dst_name = @options[:base_dst_name]
|
@@ -122,13 +131,13 @@ module Dvdvrconv
|
|
122
131
|
if @options[:number_list].class == Array
|
123
132
|
number_list = @options[:number_list]
|
124
133
|
else
|
125
|
-
puts
|
134
|
+
puts 'ERROR: number_list should be an Array.'
|
126
135
|
exit
|
127
136
|
end
|
128
137
|
|
129
138
|
else
|
130
|
-
puts
|
131
|
-
base_dst_name = dvd.vrdisc.title.uniq.map { |file| file[0].gsub(/\s/,
|
139
|
+
puts 'No customize file names'
|
140
|
+
base_dst_name = dvd.vrdisc.title.uniq.map { |file| file[0].gsub(/\s/, '_') }
|
132
141
|
number_list = []
|
133
142
|
end
|
134
143
|
|
@@ -141,9 +150,9 @@ module Dvdvrconv
|
|
141
150
|
|
142
151
|
# load yaml file and store in @options.
|
143
152
|
def load_config(file)
|
144
|
-
config = YAML.
|
153
|
+
config = YAML.safe_load(File.read(file)) || {}
|
145
154
|
|
146
|
-
%w
|
155
|
+
%w[vr_mangr_ifo vr_movie_vro dvd_vr_cmd].each do |key|
|
147
156
|
@options[key.to_sym] = nil
|
148
157
|
|
149
158
|
unless config.key?(key)
|
@@ -158,14 +167,20 @@ module Dvdvrconv
|
|
158
167
|
|
159
168
|
end
|
160
169
|
|
161
|
-
@options[:use_customize_title] = config[
|
162
|
-
@options[:base_dst_name] = config[
|
163
|
-
@options[:number_list] = config[
|
170
|
+
@options[:use_customize_title] = config['use_customize_title'] || 'no'
|
171
|
+
@options[:base_dst_name] = config['base_dst_name'] || []
|
172
|
+
@options[:number_list] = config['number_list'] || []
|
164
173
|
|
165
|
-
if config[
|
174
|
+
if config['concat_mode'].nil?
|
166
175
|
@options[:concat_mode] = Dvdvrconv::DEFAULT_CONCAT_MODE
|
167
176
|
else
|
168
|
-
@options[:concat_mode] = config[
|
177
|
+
@options[:concat_mode] = config['concat_mode']
|
178
|
+
end
|
179
|
+
|
180
|
+
if config['hardware_encode'].nil?
|
181
|
+
@options[:hardware_encode] = 'normal'
|
182
|
+
else
|
183
|
+
@options[:hardware_encode] = config['hardware_encode']
|
169
184
|
end
|
170
185
|
end
|
171
186
|
|
@@ -174,7 +189,7 @@ module Dvdvrconv
|
|
174
189
|
:vr_mangr_ifo => @options[:vr_mangr_ifo],
|
175
190
|
:vr_movie_vro => @options[:vr_movie_vro],
|
176
191
|
:dvd_vr_cmd => @options[:dvd_vr_cmd]
|
177
|
-
}
|
192
|
+
}
|
178
193
|
end
|
179
194
|
end
|
180
195
|
end
|
data/lib/dvdvrconv/dvdvr.rb
CHANGED
@@ -1,36 +1,40 @@
|
|
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]
|
20
23
|
)
|
21
24
|
|
22
|
-
BASE_NAME =
|
23
|
-
DEFAULT_CONFIG_FILE =
|
25
|
+
BASE_NAME = 'DVD'
|
26
|
+
DEFAULT_CONFIG_FILE = 'default_dvdvrconv.yml'
|
24
27
|
DEFAULT_CONCAT_MODE = true
|
28
|
+
DEFAULT_HARDWARE_ENCODE = 'normal'
|
25
29
|
|
26
30
|
# Default DVD drive is "d".
|
27
31
|
# 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 =
|
32
|
+
WIN_DRV_IFO = '/cygdrive/D/DVD_RTAV/VR_MANGR.IFO'
|
33
|
+
WIN_DRV_VRO = '/cygdrive/D/DVD_RTAV/VR_MOVIE.VRO'
|
34
|
+
WIN_DRV_CMD = File.expand_path('../../win/dvd-vr.exe', __dir__)
|
35
|
+
DRV_IFO = '/mnt/d/DVD_RTAV/VR_MANGR.IFO'
|
36
|
+
DRV_VRO = '/mnt/d/DVD_RTAV/VR_MOVIE.VRO'
|
37
|
+
DRV_CMD = 'dvd-vr'
|
34
38
|
|
35
39
|
class Dvdvr
|
36
40
|
attr_accessor :vrdisc
|
@@ -52,23 +56,62 @@ module Dvdvrconv
|
|
52
56
|
@vrdisc.default_opts_vro = @vrdisc.opts_vro
|
53
57
|
@vrdisc.default_cmd = @vrdisc.cmd
|
54
58
|
@vrdisc.concat_mode = Dvdvrconv::DEFAULT_CONCAT_MODE
|
59
|
+
@vrdisc.hardware_encode = Dvdvrconv::DEFAULT_HARDWARE_ENCODE
|
55
60
|
end
|
56
61
|
|
57
62
|
# Read VRO file from dvd-ram disc in dvd-vr format, and output vob files.
|
58
63
|
def str_dvdvr_cmd
|
59
|
-
%
|
64
|
+
%(#{@vrdisc.cmd} --name=#{Dvdvrconv::BASE_NAME} #{@vrdisc.opts_ifo} #{@vrdisc.opts_vro})
|
60
65
|
end
|
61
66
|
|
62
67
|
# Make a concatenation command string for FFmpeg.
|
63
68
|
def str_concat_cmd(file_name, base_name)
|
64
|
-
%
|
69
|
+
%(ffmpeg -f concat -safe 0 -i #{file_name} -c copy #{base_name}.vob)
|
70
|
+
end
|
71
|
+
|
72
|
+
# File convert command, vob to mp4 for FFmpeg.
|
73
|
+
# * Change the aspect ratio to 16:9.
|
74
|
+
# * Delete a closed caption.
|
75
|
+
def ffmeg_normal_cmd(file_name)
|
76
|
+
cmd = 'ffmpeg '
|
77
|
+
cmd += "-i #{file_name}.vob "
|
78
|
+
cmd += '-filter:v "crop=704:474:0:0" '
|
79
|
+
cmd += '-vcodec libx264 '
|
80
|
+
cmd += '-b:v 500k '
|
81
|
+
cmd += '-aspect 16:9 '
|
82
|
+
cmd += '-acodec copy '
|
83
|
+
cmd += '-bsf:v "filter_units=remove_types=6" '
|
84
|
+
cmd + "#{file_name}.mp4"
|
65
85
|
end
|
66
86
|
|
67
87
|
# File convert command, vob to mp4 for FFmpeg.
|
88
|
+
# * FFmpeg with QSV(Intel Quick Sync Video)
|
68
89
|
# * Change the aspect ratio to 16:9.
|
69
90
|
# * Delete a closed caption.
|
91
|
+
def ffmpeg_qsv_cmd(file_name)
|
92
|
+
cmd = 'ffmpeg '
|
93
|
+
cmd += '-hwaccel qsv '
|
94
|
+
cmd += '-hwaccel_output_format qsv '
|
95
|
+
cmd += "-i #{file_name}.vob "
|
96
|
+
cmd += '-filter:v "crop=704:474:0:0" '
|
97
|
+
cmd += '-c:v h264_qsv '
|
98
|
+
cmd += '-global_quality:v 35 '
|
99
|
+
cmd += '-look_ahead 1 '
|
100
|
+
cmd += '-aspect 16:9 '
|
101
|
+
cmd += '-acodec copy '
|
102
|
+
cmd += '-bsf:v "filter_units=remove_types=6" '
|
103
|
+
cmd + "#{file_name}.mp4"
|
104
|
+
end
|
105
|
+
|
106
|
+
# File convert command, vob to mp4 for FFmpeg.
|
70
107
|
def str_convert_cmd(file_name)
|
71
|
-
|
108
|
+
if @vrdisc.hardware_encode == 'qsv'
|
109
|
+
ffmpeg_qsv_cmd(file_name)
|
110
|
+
elsif @vrdisc.hardware_encode == 'normal'
|
111
|
+
ffmeg_normal_cmd(file_name)
|
112
|
+
else
|
113
|
+
ffmeg_normal_cmd(file_name)
|
114
|
+
end
|
72
115
|
end
|
73
116
|
|
74
117
|
# Read video information from dvd-ram discs in dvd-vr format.
|
@@ -89,7 +132,7 @@ module Dvdvrconv
|
|
89
132
|
@vrdisc.header = out.scan(/^(.*?)Number/m)
|
90
133
|
|
91
134
|
# Sets the captured information to @vrdisc.
|
92
|
-
%w
|
135
|
+
%w[num title date size].each do |item|
|
93
136
|
str = format("%-5s", item) + ":"
|
94
137
|
@vrdisc[item] = out.scan(/#{str}\s(.*?)$/)
|
95
138
|
end
|
@@ -104,14 +147,14 @@ module Dvdvrconv
|
|
104
147
|
# @vrdisc.date, @vrdisc.size
|
105
148
|
#
|
106
149
|
def view_info
|
107
|
-
puts
|
150
|
+
puts '----- view dvd-vr info -----'
|
108
151
|
puts @vrdisc.header
|
109
152
|
[@vrdisc.num, @vrdisc.title, @vrdisc.date, @vrdisc.size].transpose.each do |x|
|
110
|
-
%w
|
111
|
-
line = format(
|
153
|
+
%w[num title date size].each_with_index do |item, idx|
|
154
|
+
line = format('%-5s', item) + ": #{x.flatten[idx].to_s}\n"
|
112
155
|
puts line
|
113
156
|
end
|
114
|
-
puts
|
157
|
+
puts '-'
|
115
158
|
end
|
116
159
|
end
|
117
160
|
|
@@ -140,10 +183,10 @@ module Dvdvrconv
|
|
140
183
|
# Add sequential numbers to duplicate name.
|
141
184
|
if dup.include?(@vrdisc.title[idx])
|
142
185
|
dup_counter += 1
|
143
|
-
output_title << format(
|
186
|
+
output_title << format('%s_%02d', new_name, dup_counter)
|
144
187
|
duplicate_names << new_name
|
145
188
|
else
|
146
|
-
output_title << format(
|
189
|
+
output_title << format('%s', new_name)
|
147
190
|
end
|
148
191
|
dup_counter = 0 if dup_counter == @vrdisc.title.count(@vrdisc.title[idx])
|
149
192
|
end
|
@@ -158,10 +201,10 @@ module Dvdvrconv
|
|
158
201
|
# Read VRO file from dvd-ram disc in dvd-vr format, and output vob files.
|
159
202
|
def vro2vob
|
160
203
|
cmd = str_dvdvr_cmd
|
161
|
-
puts
|
204
|
+
puts '----- convert file VRO to VOB -----'
|
162
205
|
puts "> cmd:\n #{cmd}"
|
163
206
|
system(cmd)
|
164
|
-
puts
|
207
|
+
puts ''
|
165
208
|
end
|
166
209
|
|
167
210
|
# Change the file name to the title name
|
@@ -176,8 +219,8 @@ module Dvdvrconv
|
|
176
219
|
vob_titles = []
|
177
220
|
|
178
221
|
@vrdisc.title.size.times do |x|
|
179
|
-
src = format(
|
180
|
-
dst = @vrdisc.output_title[x] +
|
222
|
+
src = format('%s#%03d', Dvdvrconv::BASE_NAME, x + 1) + '.vob'
|
223
|
+
dst = @vrdisc.output_title[x] + '.vob'
|
181
224
|
vob_titles << [src, dst]
|
182
225
|
end
|
183
226
|
|
@@ -221,26 +264,26 @@ module Dvdvrconv
|
|
221
264
|
titels = @vrdisc.output_title
|
222
265
|
end
|
223
266
|
|
224
|
-
titels.each_with_index do |title, idx|
|
225
|
-
src = title.gsub(/\s/,
|
267
|
+
titels.each_with_index do |title, idx|
|
268
|
+
src = title.gsub(/\s/, '_') + '.vob'
|
226
269
|
|
227
270
|
case base_dst_name
|
228
271
|
when Array
|
229
272
|
dst_name = base_dst_name[idx]
|
230
273
|
when String
|
231
274
|
if number_list.size.zero?
|
232
|
-
dst_name = base_dst_name + format(
|
275
|
+
dst_name = base_dst_name + format('_%02d', idx + 1)
|
233
276
|
else
|
234
277
|
case number_list[idx]
|
235
278
|
when Numeric
|
236
|
-
dst_name = base_dst_name + format(
|
279
|
+
dst_name = base_dst_name + format('_%02d', number_list[idx])
|
237
280
|
when String
|
238
|
-
dst_name = base_dst_name + format(
|
281
|
+
dst_name = base_dst_name + format('_%s', number_list[idx])
|
239
282
|
end
|
240
283
|
end
|
241
284
|
end
|
242
285
|
|
243
|
-
dst = dst_name +
|
286
|
+
dst = dst_name + '.vob'
|
244
287
|
vob_titles << [src, dst]
|
245
288
|
end
|
246
289
|
|
@@ -256,7 +299,7 @@ module Dvdvrconv
|
|
256
299
|
# @vrdisc.vob_titles
|
257
300
|
#
|
258
301
|
def rename_vob
|
259
|
-
puts
|
302
|
+
puts '----- output vob file -----'
|
260
303
|
|
261
304
|
@vrdisc.vob_titles.each do |file_title|
|
262
305
|
src, dst = file_title
|
@@ -279,11 +322,11 @@ module Dvdvrconv
|
|
279
322
|
concat_list = []
|
280
323
|
|
281
324
|
@vrdisc.duplicate_name.each do |base_name|
|
282
|
-
contents =
|
325
|
+
contents = ''
|
283
326
|
file_name = "concat_#{base_name}.txt"
|
284
327
|
|
285
328
|
names = @vrdisc.output_title.select { |x| x.match(/#{base_name}_\d\d/) }
|
286
|
-
names.each { |line| contents +=
|
329
|
+
names.each { |line| contents += "file '#{line}.vob'\n" }
|
287
330
|
concat_list << [file_name, contents, base_name]
|
288
331
|
end
|
289
332
|
|
@@ -305,14 +348,14 @@ module Dvdvrconv
|
|
305
348
|
# @param [String] base_name output vob name.
|
306
349
|
#
|
307
350
|
def concat_titles(concat_list)
|
308
|
-
puts
|
351
|
+
puts '----- Concatenate Split Titles -----'
|
309
352
|
concat_list.each do |list|
|
310
353
|
file_name, contents, base_name = list
|
311
354
|
File.write(file_name, contents)
|
312
355
|
puts "concat list= #{file_name}"
|
313
356
|
|
314
357
|
cmd = str_concat_cmd(file_name, base_name)
|
315
|
-
puts
|
358
|
+
puts '----- concat vob files -----'
|
316
359
|
puts "run cmd:\n #{cmd}"
|
317
360
|
system(cmd)
|
318
361
|
|
@@ -326,7 +369,7 @@ module Dvdvrconv
|
|
326
369
|
|
327
370
|
def vrdisc_status
|
328
371
|
puts "\n< < < < < @vrdisc status > > > > >"
|
329
|
-
%w
|
372
|
+
%w[num title output_title duplicate_name vob_titles concat_mode hardware_encode].each do |item|
|
330
373
|
puts "#{item}=> #{@vrdisc[item]}"
|
331
374
|
end
|
332
375
|
puts "< < < < < @vrdisc status > > > > >\n"
|
@@ -341,7 +384,7 @@ module Dvdvrconv
|
|
341
384
|
files = []
|
342
385
|
|
343
386
|
@vrdisc.vob_titles.each do |vob_title|
|
344
|
-
files << vob_title[1].gsub(/.vob/,
|
387
|
+
files << vob_title[1].gsub(/.vob/, '')
|
345
388
|
end
|
346
389
|
|
347
390
|
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.0
|
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: []
|