ehbrs_ruby_utils 0.40.0 → 0.41.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/lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb +2 -2
- data/lib/ehbrs_ruby_utils/music/lyrics_book/song.rb +1 -1
- data/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/lib/ehbrs_ruby_utils/videos/{container.rb → file.rb} +1 -1
- data/lib/ehbrs_ruby_utils/videos/stream.rb +33 -2
- data/lib/ehbrs_ruby_utils/videos2/convert_job.rb +99 -0
- data/lib/ehbrs_ruby_utils/videos2/extract/package.rb +75 -0
- data/lib/ehbrs_ruby_utils/videos2/extract/package_file.rb +53 -0
- data/lib/ehbrs_ruby_utils/videos2/extract.rb +11 -0
- data/lib/ehbrs_ruby_utils/videos2/profiles/base.rb +35 -0
- data/lib/ehbrs_ruby_utils/videos2/profiles/same_quality.rb +21 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/check_result.rb +24 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb +43 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/check_support.rb +71 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_extra_unlisted.rb +29 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_extra_unsupported.rb +28 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_unlisted.rb +25 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_unsupported.rb +27 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/invalid_extension.rb +27 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/checks.rb +13 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/file/fix.rb +45 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/file.rb +51 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb +44 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec/ffmpeg_args.rb +68 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec.rb +15 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_container.rb +17 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/aoc.rb +27 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/base.rb +117 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/philco.rb +28 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/samsung.rb +33 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles.rb +13 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/search.rb +75 -0
- data/lib/ehbrs_ruby_utils/videos2/unsupported/track.rb +32 -0
- data/lib/ehbrs_ruby_utils/videos2.rb +9 -0
- metadata +32 -3
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/videos/file'
|
4
|
+
require 'ehbrs_ruby_utils/videos2/convert_job'
|
5
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/fix_profile'
|
6
|
+
|
7
|
+
module EhbrsRubyUtils
|
8
|
+
module Videos2
|
9
|
+
module Unsupported
|
10
|
+
class File < ::EhbrsRubyUtils::Videos::File
|
11
|
+
module Fix
|
12
|
+
def check_fix
|
13
|
+
return unless options.fetch(:fix)
|
14
|
+
|
15
|
+
if fix_blocks.any?
|
16
|
+
infom ' * Cannot fix:'
|
17
|
+
fix_blocks.each do |fb|
|
18
|
+
infom " * #{fb.check.check_name}"
|
19
|
+
end
|
20
|
+
else
|
21
|
+
infom ' * Fixing...'
|
22
|
+
infom " * Fixed in: \"#{fix}\""
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def all_fix_blocks_uncached
|
29
|
+
fix_blocks + tracks.flat_map(&:fix_blocks)
|
30
|
+
end
|
31
|
+
|
32
|
+
def fix_profile_uncached
|
33
|
+
::EhbrsRubyUtils::Videos2::Unsupported::FixProfile.new(self)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fix
|
37
|
+
job = ::EhbrsRubyUtils::Videos2::ConvertJob.new(path, fix_profile)
|
38
|
+
job.run
|
39
|
+
job.target
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/videos/file'
|
4
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/file/fix'
|
5
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/check_support'
|
6
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/track'
|
7
|
+
|
8
|
+
module EhbrsRubyUtils
|
9
|
+
module Videos2
|
10
|
+
module Unsupported
|
11
|
+
class File < ::EhbrsRubyUtils::Videos::File
|
12
|
+
include ::EhbrsRubyUtils::Videos2::Unsupported::CheckSupport
|
13
|
+
include ::EhbrsRubyUtils::Videos2::Unsupported::File::Fix
|
14
|
+
|
15
|
+
attr_reader :options
|
16
|
+
|
17
|
+
def initialize(file, options)
|
18
|
+
super(file)
|
19
|
+
@options = options
|
20
|
+
end
|
21
|
+
|
22
|
+
def banner
|
23
|
+
infov 'File', path
|
24
|
+
pad_speaker do
|
25
|
+
aggressions_banner('Self')
|
26
|
+
tracks.each(&:banner)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def all_passed?
|
31
|
+
passed? && tracks.all?(&:passed?)
|
32
|
+
end
|
33
|
+
|
34
|
+
def all_fixes
|
35
|
+
fixes + tracks.flat_map(&:fixes)
|
36
|
+
end
|
37
|
+
|
38
|
+
def check_set_key
|
39
|
+
:file_check_set
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# @return [Enumerable<EhbrsRubyUtils::Videos2::Unsupported::Track>]
|
45
|
+
def tracks_uncached
|
46
|
+
streams.reject.map { |t| ::EhbrsRubyUtils::Videos2::Unsupported::Track.new(self, t) }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/videos2/profiles/same_quality'
|
4
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/fixes/supported_container'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Videos2
|
8
|
+
module Unsupported
|
9
|
+
class FixProfile
|
10
|
+
include ::EhbrsRubyUtils::Videos2::Profiles::SameQuality
|
11
|
+
|
12
|
+
common_constructor :video
|
13
|
+
set_callback :swap, :after do
|
14
|
+
video.all_fixes.each do |fix|
|
15
|
+
next unless fix.respond_to?(:after_swap)
|
16
|
+
|
17
|
+
fix.after_swap(self)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def name
|
22
|
+
"fix_for_#{::File.basename(video.file)}"
|
23
|
+
end
|
24
|
+
|
25
|
+
def ffmpeg_args
|
26
|
+
r = fix_args
|
27
|
+
r += container_fix_args unless r.include?('-f')
|
28
|
+
r + super
|
29
|
+
end
|
30
|
+
|
31
|
+
private
|
32
|
+
|
33
|
+
def fix_args
|
34
|
+
['-c', 'copy'] + video.ffmpeg_fix_args +
|
35
|
+
video.tracks.flat_map(&:ffmpeg_fix_args)
|
36
|
+
end
|
37
|
+
|
38
|
+
def container_fix_args
|
39
|
+
['-f', ::EhbrsRubyUtils::Videos2::Unsupported::Fixes::SupportedContainer::FIX_FORMAT]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EhbrsRubyUtils
|
4
|
+
module Videos2
|
5
|
+
module Unsupported
|
6
|
+
module Fixes
|
7
|
+
class SupportedCodec
|
8
|
+
class FfmpegArgs
|
9
|
+
FORMATS = {
|
10
|
+
i: :index,
|
11
|
+
f: :target_codec,
|
12
|
+
t: :codec_type_letter
|
13
|
+
}.freeze
|
14
|
+
|
15
|
+
SOURCE_COMMON_ARGS = ['-%tcodec:%i', '%f'].freeze
|
16
|
+
SOURCE_AUDIO_ARGS = SOURCE_COMMON_ARGS
|
17
|
+
SOURCE_SUBTITLE_ARGS = SOURCE_COMMON_ARGS
|
18
|
+
SOURCE_VIDEO_ARGS = SOURCE_COMMON_ARGS + ['-crf', '17', '-filter:%t', 'format=yuv420p']
|
19
|
+
|
20
|
+
TARGET_CODECS = {
|
21
|
+
audio: 'aac',
|
22
|
+
video: 'libx264',
|
23
|
+
subtitle: 'ass'
|
24
|
+
}.freeze
|
25
|
+
|
26
|
+
acts_as_instance_method
|
27
|
+
common_constructor :owner, :track
|
28
|
+
|
29
|
+
# @return [Array<String>]
|
30
|
+
def result
|
31
|
+
source_args_by_codec_type.map { |arg| target_arg(arg) }
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# @return [String]
|
37
|
+
def codec_type_letter
|
38
|
+
track.codec_type.to_s[0].downcase
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [String]
|
42
|
+
def index
|
43
|
+
track.index.to_s
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [Array<String>]
|
47
|
+
def source_args_by_codec_type
|
48
|
+
self.class.const_get("SOURCE_#{track.codec_type.to_s.underscore.upcase}_ARGS")
|
49
|
+
end
|
50
|
+
|
51
|
+
# @param arg [String]
|
52
|
+
# @return [String]
|
53
|
+
def target_arg(arg)
|
54
|
+
FORMATS.inject(arg) do |a, e|
|
55
|
+
a.gsub("%#{e.first}", send(e.last))
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
# @return [String]
|
60
|
+
def target_codec
|
61
|
+
TARGET_CODECS.fetch(track.codec_type.to_s.underscore.to_sym)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Videos2
|
7
|
+
module Unsupported
|
8
|
+
module Fixes
|
9
|
+
class SupportedCodec
|
10
|
+
require_sub __FILE__, require_mode: :kernel
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EhbrsRubyUtils
|
4
|
+
module Videos2
|
5
|
+
module Unsupported
|
6
|
+
module Fixes
|
7
|
+
class SupportedContainer
|
8
|
+
FIX_FORMAT = 'matroska'
|
9
|
+
|
10
|
+
def ffmpeg_args(_video)
|
11
|
+
['-f', FIX_FORMAT]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/profiles/base'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Videos2
|
7
|
+
module Unsupported
|
8
|
+
module Profiles
|
9
|
+
class Aoc < ::EhbrsRubyUtils::Videos2::Unsupported::Profiles::Base
|
10
|
+
AUDIO_SUPPORTED_CODECS = %w[aac ac3 mp2 mp3].freeze
|
11
|
+
AUDIO_UNSUPPORTED_CODECS = %w[eac3 vorbis].freeze
|
12
|
+
|
13
|
+
VIDEO_SUPPORTED_CODECS = %w[h264 mpeg4].freeze
|
14
|
+
VIDEO_UNSUPPORTED_CODECS = %w[hevc].freeze
|
15
|
+
|
16
|
+
SUBTITLE_SUPPORTED_CODECS = %w[ass dvd_subtitle hdmv_pgs_subtitle subrip].freeze
|
17
|
+
SUBTITLE_UNSUPPORTED_CODECS = %w[mov_text].freeze
|
18
|
+
|
19
|
+
OTHER_SUPPORTED_CODECS = %w[].freeze
|
20
|
+
|
21
|
+
MPEG4_EXTRA_SUPPORTED = %w[xvid].freeze
|
22
|
+
MPEG4_EXTRA_UNSUPPORTED = %w[].freeze
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EhbrsRubyUtils
|
4
|
+
module Videos2
|
5
|
+
module Unsupported
|
6
|
+
module Profiles
|
7
|
+
class Base
|
8
|
+
enable_simple_cache
|
9
|
+
include ::Singleton
|
10
|
+
|
11
|
+
CONSTANT_PREFIXES = %w[video audio subtitle other].freeze
|
12
|
+
|
13
|
+
def added_checks
|
14
|
+
@added_checks ||= []
|
15
|
+
end
|
16
|
+
|
17
|
+
def add_check(name, *args)
|
18
|
+
check_path = "ehbrs_ruby_utils/videos2/unsupported/checks/#{name}"
|
19
|
+
added_checks << check_path.camelize.constantize.new(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def base_checks
|
23
|
+
[unlisted_codec_check] + unsupported_codec_checks +
|
24
|
+
supported_codecs.flat_map { |codec| codec_extra_checks(codec) }
|
25
|
+
end
|
26
|
+
|
27
|
+
def checks
|
28
|
+
base_checks + added_checks
|
29
|
+
end
|
30
|
+
|
31
|
+
def file_checks
|
32
|
+
checks.select { |c| check_type(c) == :container }
|
33
|
+
end
|
34
|
+
|
35
|
+
def track_checks
|
36
|
+
checks.select { |c| check_type(c) == :stream }
|
37
|
+
end
|
38
|
+
|
39
|
+
def codec_extra_checks(codec)
|
40
|
+
codec_unlisted_extra_check(codec).if_present([]) { |v| [v] } +
|
41
|
+
codec_unsupported_extras(codec).map do |extra|
|
42
|
+
EhbrsRubyUtils::Videos2::Unsupported::Checks::CodecExtraUnsupported.new(codec,
|
43
|
+
extra)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def codec_unlisted_extra_check(codec)
|
48
|
+
extras = codec_unsupported_extras(codec) + codec_supported_extras(codec)
|
49
|
+
return nil unless extras.any?
|
50
|
+
|
51
|
+
EhbrsRubyUtils::Videos2::Unsupported::Checks::CodecExtraUnlisted.new(
|
52
|
+
codec, extras.sort.uniq
|
53
|
+
)
|
54
|
+
end
|
55
|
+
|
56
|
+
def name
|
57
|
+
self.class.name.demodulize.underscore
|
58
|
+
end
|
59
|
+
|
60
|
+
def to_s
|
61
|
+
name
|
62
|
+
end
|
63
|
+
|
64
|
+
def unsupported_codec_checks
|
65
|
+
unsupported_codecs.map do |codec|
|
66
|
+
EhbrsRubyUtils::Videos2::Unsupported::Checks::CodecUnsupported.new(codec)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
def unsupported_codecs_uncached
|
71
|
+
codecs_by_constant('unsupported')
|
72
|
+
end
|
73
|
+
|
74
|
+
def unlisted_codec_check
|
75
|
+
::EhbrsRubyUtils::Videos2::Unsupported::Checks::CodecUnlisted.new(
|
76
|
+
(supported_codecs + unsupported_codecs).sort.uniq
|
77
|
+
)
|
78
|
+
end
|
79
|
+
|
80
|
+
def supported_codecs_uncached
|
81
|
+
codecs_by_constant('supported')
|
82
|
+
end
|
83
|
+
|
84
|
+
def codecs_by_constant(middle)
|
85
|
+
CONSTANT_PREFIXES.inject([]) { |a, e| a + codecs_by_prefix(e, middle) }
|
86
|
+
end
|
87
|
+
|
88
|
+
def codecs_by_prefix(prefix, middle)
|
89
|
+
self.class.const_get("#{prefix}_#{middle}_codecs".upcase)
|
90
|
+
rescue NameError
|
91
|
+
[]
|
92
|
+
end
|
93
|
+
|
94
|
+
def codec_extras(codec, suffix)
|
95
|
+
self.class.const_get("#{codec}_extra_#{suffix}".upcase)
|
96
|
+
rescue NameError
|
97
|
+
[]
|
98
|
+
end
|
99
|
+
|
100
|
+
def codec_unsupported_extras(codec)
|
101
|
+
codec_extras(codec, 'unsupported')
|
102
|
+
end
|
103
|
+
|
104
|
+
def codec_supported_extras(codec)
|
105
|
+
codec_extras(codec, 'supported')
|
106
|
+
end
|
107
|
+
|
108
|
+
private
|
109
|
+
|
110
|
+
def check_type(check)
|
111
|
+
check.class.const_get(:TYPE)
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/profiles/base'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Videos2
|
7
|
+
module Unsupported
|
8
|
+
module Profiles
|
9
|
+
class Philco < ::EhbrsRubyUtils::Videos2::Unsupported::Profiles::Base
|
10
|
+
AUDIO_SUPPORTED_CODECS = %w[aac ac3 eac3 mp3 vorbis wmav2].freeze
|
11
|
+
AUDIO_UNSUPPORTED_CODECS = %w[dts opus].freeze
|
12
|
+
|
13
|
+
VIDEO_SUPPORTED_CODECS = %w[h264 mpeg4].freeze
|
14
|
+
VIDEO_UNSUPPORTED_CODECS = %w[hevc msmpeg4v3].freeze
|
15
|
+
|
16
|
+
SUBTITLE_SUPPORTED_CODECS = %w[ass dvd dvd_subtitle hdmv_pgs_subtitle mov_text
|
17
|
+
subrip].freeze
|
18
|
+
SUBTITLE_UNSUPPORTED_CODECS = %w[mov].freeze
|
19
|
+
|
20
|
+
OTHER_SUPPORTED_CODECS = %w[png ttf].freeze
|
21
|
+
|
22
|
+
MPEG4_EXTRA_SUPPORTED = %w[xvid].freeze
|
23
|
+
MPEG4_EXTRA_UNSUPPORTED = %w[divx dx50].freeze
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/checks/invalid_extension'
|
4
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/profiles/base'
|
5
|
+
|
6
|
+
module EhbrsRubyUtils
|
7
|
+
module Videos2
|
8
|
+
module Unsupported
|
9
|
+
module Profiles
|
10
|
+
class Samsung < ::EhbrsRubyUtils::Videos2::Unsupported::Profiles::Base
|
11
|
+
AUDIO_SUPPORTED_CODECS = %w[aac ac3 eac3 mp3 vorbis].freeze
|
12
|
+
AUDIO_UNSUPPORTED_CODECS = %w[dts].freeze
|
13
|
+
|
14
|
+
VIDEO_SUPPORTED_CODECS = %w[h264 mpeg4 hevc mjpeg].freeze
|
15
|
+
VIDEO_UNSUPPORTED_CODECS = %w[].freeze
|
16
|
+
|
17
|
+
SUBTITLE_SUPPORTED_CODECS = %w[ass dvd dvd_subtitle hdmv_pgs_subtitle subrip].freeze
|
18
|
+
SUBTITLE_UNSUPPORTED_CODECS = %w[mov mov_text].freeze
|
19
|
+
|
20
|
+
OTHER_SUPPORTED_CODECS = %w[png ttf].freeze
|
21
|
+
|
22
|
+
MPEG4_EXTRA_SUPPORTED = %w[].freeze
|
23
|
+
MPEG4_EXTRA_UNSUPPORTED = %w[dx50 xvid].freeze
|
24
|
+
|
25
|
+
def initialize
|
26
|
+
super()
|
27
|
+
add_check('invalid_extension', '.m4v')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,75 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_fs/traversable'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/file'
|
6
|
+
|
7
|
+
module EhbrsRubyUtils
|
8
|
+
module Videos2
|
9
|
+
module Unsupported
|
10
|
+
class Search
|
11
|
+
include ::EacFs::Traversable
|
12
|
+
enable_speaker
|
13
|
+
enable_simple_cache
|
14
|
+
|
15
|
+
VALID_EXTENSIONS = %w[.avi .mp4 .mkv .m4v].freeze
|
16
|
+
|
17
|
+
def initialize(root, file_options)
|
18
|
+
@root = root
|
19
|
+
@file_options = file_options
|
20
|
+
@files = 0
|
21
|
+
@videos = 0
|
22
|
+
@unsupported = 0
|
23
|
+
run
|
24
|
+
end
|
25
|
+
|
26
|
+
def traverser_recursive
|
27
|
+
true
|
28
|
+
end
|
29
|
+
|
30
|
+
def traverser_sort
|
31
|
+
true
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def run
|
37
|
+
start_banner
|
38
|
+
traverser_check_path(@root)
|
39
|
+
end_banner
|
40
|
+
end
|
41
|
+
|
42
|
+
def traverser_check_file(file)
|
43
|
+
@files += 1
|
44
|
+
check_video(file) if video_file?(file)
|
45
|
+
end
|
46
|
+
|
47
|
+
def check_video(file)
|
48
|
+
@videos += 1
|
49
|
+
v = ::EhbrsRubyUtils::Videos2::Unsupported::File.new(file, @file_options)
|
50
|
+
return if v.all_passed?
|
51
|
+
|
52
|
+
@unsupported += 1
|
53
|
+
v.banner
|
54
|
+
v.check_fix
|
55
|
+
end
|
56
|
+
|
57
|
+
def start_banner
|
58
|
+
infom "Searching in: \"#{@root}\""
|
59
|
+
end
|
60
|
+
|
61
|
+
def end_banner
|
62
|
+
infom "Unsupported/Videos/Files: #{@unsupported}/#{@videos}/#{@files}"
|
63
|
+
end
|
64
|
+
|
65
|
+
def video_file?(path)
|
66
|
+
valid_extensions.include?(::File.extname(path))
|
67
|
+
end
|
68
|
+
|
69
|
+
def valid_extensions
|
70
|
+
self.class::VALID_EXTENSIONS
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs_ruby_utils/videos2/unsupported/check_support'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Videos2
|
7
|
+
module Unsupported
|
8
|
+
class Track < ::SimpleDelegator
|
9
|
+
include ::EhbrsRubyUtils::Videos2::Unsupported::CheckSupport
|
10
|
+
|
11
|
+
enable_speaker
|
12
|
+
enable_simple_cache
|
13
|
+
attr_reader :video
|
14
|
+
|
15
|
+
def initialize(video, track)
|
16
|
+
@video = video
|
17
|
+
super(track)
|
18
|
+
end
|
19
|
+
|
20
|
+
def banner
|
21
|
+
aggressions_banner("Track #{self}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def check_set_key
|
25
|
+
:track_check_set
|
26
|
+
end
|
27
|
+
|
28
|
+
delegate :options, to: :video
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehbrs_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.41.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-01-
|
11
|
+
date: 2024-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aranha
|
@@ -343,8 +343,8 @@ files:
|
|
343
343
|
- lib/ehbrs_ruby_utils/vg/wii/wit/parsers/info.rb
|
344
344
|
- lib/ehbrs_ruby_utils/vg/wii/wit/path.rb
|
345
345
|
- lib/ehbrs_ruby_utils/videos.rb
|
346
|
-
- lib/ehbrs_ruby_utils/videos/container.rb
|
347
346
|
- lib/ehbrs_ruby_utils/videos/convert_job.rb
|
347
|
+
- lib/ehbrs_ruby_utils/videos/file.rb
|
348
348
|
- lib/ehbrs_ruby_utils/videos/opensubtitles.rb
|
349
349
|
- lib/ehbrs_ruby_utils/videos/opensubtitles/parsers.rb
|
350
350
|
- lib/ehbrs_ruby_utils/videos/opensubtitles/parsers/episode.rb
|
@@ -372,6 +372,35 @@ files:
|
|
372
372
|
- lib/ehbrs_ruby_utils/videos/subtitles/sanitize/content_sanitizer.rb
|
373
373
|
- lib/ehbrs_ruby_utils/videos/subtitles/sanitize/with_pattern_matcher.rb
|
374
374
|
- lib/ehbrs_ruby_utils/videos/subtitles/sanitize/with_term_matcher.rb
|
375
|
+
- lib/ehbrs_ruby_utils/videos2.rb
|
376
|
+
- lib/ehbrs_ruby_utils/videos2/convert_job.rb
|
377
|
+
- lib/ehbrs_ruby_utils/videos2/extract.rb
|
378
|
+
- lib/ehbrs_ruby_utils/videos2/extract/package.rb
|
379
|
+
- lib/ehbrs_ruby_utils/videos2/extract/package_file.rb
|
380
|
+
- lib/ehbrs_ruby_utils/videos2/profiles/base.rb
|
381
|
+
- lib/ehbrs_ruby_utils/videos2/profiles/same_quality.rb
|
382
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/check_result.rb
|
383
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb
|
384
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/check_support.rb
|
385
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/checks.rb
|
386
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_extra_unlisted.rb
|
387
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_extra_unsupported.rb
|
388
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_unlisted.rb
|
389
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_unsupported.rb
|
390
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/checks/invalid_extension.rb
|
391
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/file.rb
|
392
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/file/fix.rb
|
393
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb
|
394
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec.rb
|
395
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec/ffmpeg_args.rb
|
396
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_container.rb
|
397
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/profiles.rb
|
398
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/profiles/aoc.rb
|
399
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/profiles/base.rb
|
400
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/profiles/philco.rb
|
401
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/profiles/samsung.rb
|
402
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/search.rb
|
403
|
+
- lib/ehbrs_ruby_utils/videos2/unsupported/track.rb
|
375
404
|
- lib/ehbrs_ruby_utils/web_utils.rb
|
376
405
|
- lib/ehbrs_ruby_utils/web_utils/instance.rb
|
377
406
|
- lib/ehbrs_ruby_utils/web_utils/instance/finances.rb
|