ehbrs_ruby_utils 0.40.0 → 0.41.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs_ruby_utils/bga/parsers/game_in_progress.rb +22 -12
  3. data/lib/ehbrs_ruby_utils/bga/session/player_tables_on_game_in_progress.rb +17 -1
  4. data/lib/ehbrs_ruby_utils/bga/session/skip_trophies.rb +2 -2
  5. data/lib/ehbrs_ruby_utils/music/lyrics_book/song.rb +1 -1
  6. data/lib/ehbrs_ruby_utils/version.rb +1 -1
  7. data/lib/ehbrs_ruby_utils/videos/{container.rb → file.rb} +1 -1
  8. data/lib/ehbrs_ruby_utils/videos/stream.rb +33 -2
  9. data/lib/ehbrs_ruby_utils/videos2/convert_job.rb +99 -0
  10. data/lib/ehbrs_ruby_utils/videos2/extract/package.rb +75 -0
  11. data/lib/ehbrs_ruby_utils/videos2/extract/package_file.rb +53 -0
  12. data/lib/ehbrs_ruby_utils/videos2/extract.rb +11 -0
  13. data/lib/ehbrs_ruby_utils/videos2/profiles/base.rb +35 -0
  14. data/lib/ehbrs_ruby_utils/videos2/profiles/same_quality.rb +21 -0
  15. data/lib/ehbrs_ruby_utils/videos2/unsupported/check_result.rb +24 -0
  16. data/lib/ehbrs_ruby_utils/videos2/unsupported/check_set.rb +43 -0
  17. data/lib/ehbrs_ruby_utils/videos2/unsupported/check_support.rb +71 -0
  18. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_extra_unlisted.rb +29 -0
  19. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_extra_unsupported.rb +28 -0
  20. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_unlisted.rb +25 -0
  21. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/codec_unsupported.rb +27 -0
  22. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks/invalid_extension.rb +27 -0
  23. data/lib/ehbrs_ruby_utils/videos2/unsupported/checks.rb +13 -0
  24. data/lib/ehbrs_ruby_utils/videos2/unsupported/file/fix.rb +45 -0
  25. data/lib/ehbrs_ruby_utils/videos2/unsupported/file.rb +51 -0
  26. data/lib/ehbrs_ruby_utils/videos2/unsupported/fix_profile.rb +44 -0
  27. data/lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec/ffmpeg_args.rb +68 -0
  28. data/lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec.rb +15 -0
  29. data/lib/ehbrs_ruby_utils/videos2/unsupported/fixes/supported_container.rb +17 -0
  30. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/aoc.rb +27 -0
  31. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/base.rb +117 -0
  32. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/philco.rb +28 -0
  33. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles/samsung.rb +33 -0
  34. data/lib/ehbrs_ruby_utils/videos2/unsupported/profiles.rb +13 -0
  35. data/lib/ehbrs_ruby_utils/videos2/unsupported/search.rb +75 -0
  36. data/lib/ehbrs_ruby_utils/videos2/unsupported/track.rb +32 -0
  37. data/lib/ehbrs_ruby_utils/videos2.rb +9 -0
  38. metadata +42 -7
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Unsupported
8
+ module Checks
9
+ class CodecExtraUnsupported
10
+ TYPE = :stream
11
+
12
+ common_constructor :codec, :extra
13
+
14
+ def check(track)
15
+ return nil unless track.codec_name == codec
16
+ return nil unless track.codec_tag_string.downcase.include?(extra.downcase)
17
+
18
+ "Unsupported extra \"#{extra}\" for codec \"#{codec}\" and track #{track}"
19
+ end
20
+
21
+ def fix
22
+ ::EhbrsRubyUtils::Videos2::Unsupported::Fixes::SupportedCodec.new
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Videos2
5
+ module Unsupported
6
+ module Checks
7
+ class CodecUnlisted
8
+ TYPE = :stream
9
+
10
+ common_constructor :listed_codecs
11
+
12
+ def check(track)
13
+ return nil if listed_codecs.include?(track.codec_name)
14
+
15
+ "Not listed codec \"#{track.codec_name}\" (Track: #{track}, listed: #{listed_codecs})"
16
+ end
17
+
18
+ def fix
19
+ nil
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs_ruby_utils/videos2/unsupported/fixes/supported_codec'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Unsupported
8
+ module Checks
9
+ class CodecUnsupported
10
+ TYPE = :stream
11
+
12
+ common_constructor :codec
13
+
14
+ def check(track)
15
+ return nil unless track.codec_name == codec
16
+
17
+ "Unsupported codec \"#{codec}\" for track #{track}"
18
+ end
19
+
20
+ def fix
21
+ ::EhbrsRubyUtils::Videos2::Unsupported::Fixes::SupportedCodec.new
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs_ruby_utils/videos2/unsupported/fixes/supported_container'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Unsupported
8
+ module Checks
9
+ class InvalidExtension
10
+ TYPE = :container
11
+
12
+ common_constructor :extension
13
+
14
+ def check(video)
15
+ return nil unless ::File.extname(video.path) == extension
16
+
17
+ "File has invalid extension: #{extension}"
18
+ end
19
+
20
+ def fix
21
+ ::EhbrsRubyUtils::Videos2::Unsupported::Fixes::SupportedContainer.new
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,13 @@
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 Checks
9
+ require_sub __FILE__
10
+ end
11
+ end
12
+ end
13
+ end
@@ -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,13 @@
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 Profiles
9
+ require_sub __FILE__
10
+ end
11
+ end
12
+ end
13
+ 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