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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 86fcf26dbec53e9e7e2b04d2197849a7f17ad0850b07d4420e26a115841c3a32
4
- data.tar.gz: 3a62e456a9d8965f914b47ccd483a92656058cc0a59f99aef595c772fdfeb05e
3
+ metadata.gz: 586c5869279d721b48b5cf6d6ce585edc26601a00aff87f412fa0cad3142206e
4
+ data.tar.gz: bf287e776722f8b92f3f7fe7832fdc574251c4ebee744c1f3018ef2957e278d7
5
5
  SHA512:
6
- metadata.gz: 171835d362844886ba8032527dd298a8da9913b9a699570686252a35209c8976e77e658ef9ca22a2e386313386a68a1dfc064298832bc9e4a8c622be6a06f89a
7
- data.tar.gz: 1b03d32256cbf9e3e27dafd52acaac5ae977a0911d014da72ef97b9ef3ba3ff10e66b62208b139d60a42efc0626b320ba226c6b24dfd1cdbab3310b0eeb3cce6
6
+ metadata.gz: ba4bc8bce782d16640c2e984ffd02f1a4a8dd390921f136321697efc1d3dd03339baeac2722ff5f1d9f858e44f3d616b3bb1b83dca6358d5993f621c3fd6593a
7
+ data.tar.gz: f9711900cb11defad1165a869e77bdc5ff160b7a070f79870bd927c624871271476505900b1d45dd88bf7598191809879b84fc9c3f40d5f6a37d5302caf47c83
@@ -7,30 +7,40 @@ module EhbrsRubyUtils
7
7
  module Bga
8
8
  module Parsers
9
9
  class GameInProgress < ::Aranha::Parsers::Html::ItemList
10
- ITEMS_XPATH = '//*[@id = "gametables_inprogress_all"]' \
11
- '//*[starts-with(@id, "gametableblock_")]'
10
+ DEFAULT_STATUS = 'asyncplay'
11
+ ID_PARSER = /table=(\d+)/.to_parser { |m| m[1].to_i }
12
+ ITEMS_XPATH = '//*[@id = "section-play"]//a[contains(@href, "table=")]'
12
13
  STATUS_CLASS_PATTERN = /\Agametable_status_(.+)\z/.freeze
13
14
  STATUS_CLASS_PARSER = STATUS_CLASS_PATTERN.to_parser { |m| m[1] }
15
+ TABLE_COUNT_XPATH =
16
+ '//*[@id = "section-play"]/h1/span[contains(@class, "font-normal")]/span/text()'
14
17
 
15
- field :id, :integer, './@id'
16
- field :status, :string, './@class'
18
+ field :href, :string, './@href'
19
+
20
+ def data
21
+ {
22
+ table_count: table_count,
23
+ tables: items_data
24
+ }
25
+ end
17
26
 
18
27
  def item_data(idd)
19
- %i[status].each do |key|
20
- idd[key] = send("process_#{key}", idd.fetch(key))
21
- end
22
- idd
28
+ { id: parse_id(idd.fetch(:href)), status: 'asyncplay' }
23
29
  end
24
30
 
25
31
  def items_xpath
26
32
  ITEMS_XPATH
27
33
  end
28
34
 
29
- private
35
+ # @param href [String]
36
+ # @return [Integer]
37
+ def parse_id(href)
38
+ ID_PARSER.parse!(href)
39
+ end
30
40
 
31
- def process_status(status)
32
- status.split.lazy.map { |s| STATUS_CLASS_PARSER.parse(s.strip) }.find(&:present?) ||
33
- raise("No status class found in \"#{status}\"")
41
+ # @return [Integer]
42
+ def table_count
43
+ nokogiri.at_xpath(TABLE_COUNT_XPATH).if_present(-1) { |v| v.text.to_i }
34
44
  end
35
45
  end
36
46
  end
@@ -13,6 +13,8 @@ module EhbrsRubyUtils
13
13
  enable_simple_cache
14
14
  common_constructor :session, :player_id
15
15
 
16
+ WAIT_FOR_RESULT_SECONDS = 60
17
+
16
18
  def result
17
19
  navigate_to_page
18
20
  result_data
@@ -25,14 +27,28 @@ module EhbrsRubyUtils
25
27
 
26
28
  private
27
29
 
30
+ def current_data
31
+ ::EhbrsRubyUtils::Bga::Parsers::GameInProgress.from_content(session.current_source).data
32
+ end
33
+
28
34
  # @return [Array<Hash>]
29
35
  def result_data
30
- ::EhbrsRubyUtils::Bga::Parsers::GameInProgress.from_content(session.current_source).data
36
+ cr = nil
37
+ session.wait(WAIT_FOR_RESULT_SECONDS).until do
38
+ scroll_down
39
+ cr = current_data
40
+ cr.fetch(:tables).count == cr.fetch(:table_count)
41
+ end
42
+ cr.fetch(:tables)
31
43
  end
32
44
 
33
45
  def navigate_to_page
34
46
  session.navigate.to url
35
47
  end
48
+
49
+ def scroll_down
50
+ session.execute_script('window.scrollBy(0, 90)')
51
+ end
36
52
  end
37
53
  end
38
54
  end
@@ -19,8 +19,8 @@ module EhbrsRubyUtils
19
19
  e
20
20
  end
21
21
 
22
- def on_skip_trophies(&block)
23
- error = on_rescue_timeout(&block)
22
+ def on_skip_trophies(...)
23
+ error = on_rescue_timeout(...)
24
24
  return unless error
25
25
  raise error unless skip_trophy_overlay?
26
26
 
@@ -51,7 +51,7 @@ module EhbrsRubyUtils
51
51
  private
52
52
 
53
53
  def container_uncached
54
- ::EhbrsRubyUtils::Videos::Container.new(path)
54
+ ::EhbrsRubyUtils::Videos::File.new(path)
55
55
  end
56
56
 
57
57
  def fetch_lyrics
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EhbrsRubyUtils
4
- VERSION = '0.40.0'
4
+ VERSION = '0.41.1'
5
5
  end
@@ -10,7 +10,7 @@ require 'ultimate_lyrics/song_metadata'
10
10
 
11
11
  module EhbrsRubyUtils
12
12
  module Videos
13
- class Container
13
+ class File
14
14
  class << self
15
15
  def from_file(path)
16
16
  new(path)
@@ -10,6 +10,10 @@ module EhbrsRubyUtils
10
10
 
11
11
  lists.add_symbol :codec_type, :audio, :video, :subtitle, :data, :attachment
12
12
 
13
+ DURATION_TAG_TO_SECONDS_PARSER = /\A(\d{2}):(\d{2}):(\d{2}.\d+)\z/.to_parser do |m|
14
+ (m[1].to_i * 3600) + (m[2].to_i * 60) + m[3].to_f
15
+ end
16
+
13
17
  common_constructor :ffprobe_data do
14
18
  self.ffprobe_data = ffprobe_data.symbolize_keys.freeze
15
19
  self.class.lists.codec_type.value_validate!(codec_type)
@@ -21,8 +25,19 @@ module EhbrsRubyUtils
21
25
  end
22
26
  end
23
27
 
28
+ # @return [Integer]
29
+ def codec_tag
30
+ ffprobe_data.fetch(:codec_tag).to_i(16)
31
+ end
32
+
33
+ # @return [ActiveSupport::Duration, nil]
34
+ def duration
35
+ duration_from_root || duration_from_tags
36
+ end
37
+
38
+ # @return [String]
24
39
  def to_s
25
- "#{index}|#{codec_type}|#{codec_name}|#{language}"
40
+ [index, codec_type, codec_name, language, codec_tag_string].join('|')
26
41
  end
27
42
 
28
43
  def to_h
@@ -35,7 +50,7 @@ module EhbrsRubyUtils
35
50
  end
36
51
  end
37
52
 
38
- %i[codec_name codec_long_name height width].each do |method_name|
53
+ %i[codec_name codec_long_name codec_tag_string height width].each do |method_name|
39
54
  define_method method_name do
40
55
  ffprobe_data[method_name]
41
56
  end
@@ -60,6 +75,22 @@ module EhbrsRubyUtils
60
75
  def title
61
76
  tags[:title]
62
77
  end
78
+
79
+ private
80
+
81
+ # @return [ActiveSupport::Duration, nil]
82
+ def duration_from_root
83
+ ffprobe_data[:duration].if_present do |v|
84
+ ::ActiveSupport::Duration.build(v.to_f)
85
+ end
86
+ end
87
+
88
+ # @return [ActiveSupport::Duration, nil]
89
+ def duration_from_tags
90
+ tags[:DURATION].if_present do |v|
91
+ ::ActiveSupport::Duration.build(DURATION_TAG_TO_SECONDS_PARSER.parse!(v))
92
+ end
93
+ end
63
94
  end
64
95
  end
65
96
  end
@@ -0,0 +1,99 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/executables'
5
+ require 'fileutils'
6
+
7
+ module EhbrsRubyUtils
8
+ module Videos2
9
+ class ConvertJob
10
+ enable_speaker
11
+ enable_simple_cache
12
+
13
+ FORMATS_TO_EXTENSIONS = {
14
+ 'matroska' => '.mkv'
15
+ }.freeze
16
+
17
+ attr_reader :input, :profile
18
+
19
+ def initialize(input, profile)
20
+ raise "Input file \"#{input}\" does not exist" unless ::File.exist?(input.to_s)
21
+
22
+ @input = input
23
+ @profile = profile
24
+ end
25
+
26
+ def run
27
+ if ::File.exist?(converted)
28
+ warn("Converted file already exist: \"#{converted}\"")
29
+ else
30
+ profile.run_callbacks(:convert) { convert }
31
+ profile.run_callbacks(:swap) { swap }
32
+ end
33
+ end
34
+
35
+ def target
36
+ ::File.join(::File.dirname(input), "#{::File.basename(input, '.*')}#{target_extension}")
37
+ end
38
+
39
+ private
40
+
41
+ def command_args_uncached
42
+ r = ['-i', input] + profile_ffmpeg_args
43
+ r += ['-f', format_by_input] if format_by_args.blank?
44
+ r + [converting]
45
+ end
46
+
47
+ def convert
48
+ infov 'Convert args', command_args.shelljoin
49
+ ::EhbrsRubyUtils::Executables.ffmpeg.command.append(command_args).system!
50
+ end
51
+
52
+ def format_by_args_uncached
53
+ profile_ffmpeg_args.rindex('-f').if_present do |option_index|
54
+ profile_ffmpeg_args[option_index + 1]
55
+ end
56
+ end
57
+
58
+ def format_by_input
59
+ r = FORMATS_TO_EXTENSIONS.invert[target_extension_by_input]
60
+ return if r.present?
61
+
62
+ target_extension_by_input.gsub(/\A\./, '')
63
+ end
64
+
65
+ def format_to_extension(format)
66
+ FORMATS_TO_EXTENSIONS[format].if_present(".#{format}")
67
+ end
68
+
69
+ def profile_ffmpeg_args_uncached
70
+ profile.ffmpeg_args
71
+ end
72
+
73
+ def swap
74
+ ::FileUtils.mv(input, converted)
75
+ ::FileUtils.mv(converting, target)
76
+ end
77
+
78
+ def converting
79
+ "#{target}.converting"
80
+ end
81
+
82
+ def converted
83
+ input.basename_sub { |b| "#{b}.converted" }
84
+ end
85
+
86
+ def target_extension
87
+ target_extension_by_args || target_extension_by_input
88
+ end
89
+
90
+ def target_extension_by_args
91
+ format_by_args.if_present { |v| format_to_extension(v) }
92
+ end
93
+
94
+ def target_extension_by_input
95
+ ::File.extname(input)
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/fs/compressed_package'
5
+ require 'ehbrs_ruby_utils/videos2/extract/package_file'
6
+
7
+ module EhbrsRubyUtils
8
+ module Videos2
9
+ module Extract
10
+ class Package
11
+ enable_simple_cache
12
+
13
+ common_constructor :path, :target_dir, :qualities do
14
+ self.path = path.to_pathname
15
+ self.target_dir = target_dir.to_pathname
16
+ end
17
+
18
+ delegate :to_s, to: :path
19
+
20
+ def run(delete)
21
+ selected_files.each(&:copy_to_selected_dir)
22
+ files.each(&:move_to_quality_dir)
23
+ extract_dir.rmdir
24
+ path.unlink if delete
25
+ end
26
+
27
+ private
28
+
29
+ def files_uncached
30
+ ::Pathname.glob("#{extract_dir}/**/*").map do |file|
31
+ ::EhbrsRubyUtils::Videos2::Extract::PackageFile.new(self, file)
32
+ end
33
+ end
34
+
35
+ def extract_dir_uncached
36
+ r = target_dir / path.basename
37
+ raise "Extract directory \"#{r}\" is a file" if r.file?
38
+
39
+ r.rmtree if r.directory?
40
+ ::EhbrsRubyUtils::Fs::CompressedPackage.new(path).extract_to(r)
41
+ r
42
+ end
43
+
44
+ def files_qualities_uncached
45
+ qualities_with_default.select { |q| grouped_files.keys.include?(q) }
46
+ end
47
+
48
+ def grouped_files_uncached
49
+ r = {}
50
+ files.each do |file|
51
+ r[file.quality] ||= []
52
+ r[file.quality] << file
53
+ end
54
+ r
55
+ end
56
+
57
+ def qualities_with_default
58
+ qualities + [::EhbrsRubyUtils::Videos2::Extract::PackageFile::DEFAULT_QUALITY]
59
+ end
60
+
61
+ def selected_dir_uncached
62
+ target_dir / 'selected'
63
+ end
64
+
65
+ def selected_files
66
+ files.select { |f| f.quality == selected_quality }
67
+ end
68
+
69
+ def selected_quality_uncached
70
+ files_qualities.first
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,53 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Extract
8
+ class PackageFile
9
+ DEFAULT_QUALITY = '__default__'
10
+
11
+ enable_simple_cache
12
+ common_constructor :package, :path do
13
+ self.path = path.to_pathname
14
+ end
15
+
16
+ def copy_to_selected_dir
17
+ ::FileUtils.cp(path.to_path, selected_dir.to_path)
18
+ end
19
+
20
+ def match_quality?(quality)
21
+ path.basename_sub { |b| b.to_s.downcase }.basename
22
+ .fnmatch?("*#{quality.downcase}*".gsub(/\A\*+/, '*').gsub(/\*+\z/, '*'))
23
+ end
24
+
25
+ def move_to_quality_dir
26
+ ::FileUtils.mv(path.to_path, quality_dir.to_path)
27
+ end
28
+
29
+ private
30
+
31
+ def quality_uncached
32
+ package.qualities.find { |q| match_quality?(q) } || DEFAULT_QUALITY
33
+ end
34
+
35
+ def quality_dir
36
+ r = package.target_dir / quality
37
+ r.mkpath
38
+ r
39
+ end
40
+
41
+ def selected_dir
42
+ r = nil
43
+ r = package.target_dir / 'source' if /\.torrent/ =~ path.to_path
44
+ r = package.target_dir / 'subtitle' if /\.srt/ =~ path.to_path
45
+ raise "Destination unknown: #{path}" unless r
46
+
47
+ r.mkpath
48
+ r
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Extract
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Videos2
5
+ module Profiles
6
+ module Base
7
+ extend ::ActiveSupport::Concern
8
+
9
+ attr_reader :convert_job
10
+
11
+ included do
12
+ include ActiveSupport::Callbacks
13
+ define_callbacks :convert, :swap
14
+ end
15
+
16
+ def ffmpeg_args
17
+ []
18
+ end
19
+
20
+ def on_convert_job
21
+ old_value = convert_job
22
+ begin
23
+ yield
24
+ ensure
25
+ self.convert_job = old_value
26
+ end
27
+ end
28
+
29
+ private
30
+
31
+ attr_writer :convert_job
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs_ruby_utils/videos2/profiles/base'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Profiles
8
+ module SameQuality
9
+ extend ::ActiveSupport::Concern
10
+
11
+ included do
12
+ include ::EhbrsRubyUtils::Videos2::Profiles::Base
13
+ end
14
+
15
+ def ffmpeg_args
16
+ super + ['-q:a', '0', '-q:v', '0']
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Unsupported
8
+ class CheckResult
9
+ enable_simple_cache
10
+ common_constructor :source, :check
11
+
12
+ def passed?
13
+ message.blank?
14
+ end
15
+
16
+ private
17
+
18
+ def message_uncached
19
+ check.check(source)
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ehbrs_ruby_utils/videos2/unsupported/checks'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos2
7
+ module Unsupported
8
+ class CheckSet
9
+ enable_simple_cache
10
+ common_constructor :checks
11
+
12
+ class << self
13
+ # type: "file" or "track"
14
+ def build(profiles, type)
15
+ r = {}
16
+ profiles.each do |profile|
17
+ profile.send("#{type}_checks").each do |check|
18
+ r[check] ||= CheckWithProfiles.new(check)
19
+ r[check].add_profile(profile)
20
+ end
21
+ end
22
+ new(r.values)
23
+ end
24
+ end
25
+
26
+ class CheckWithProfiles < ::SimpleDelegator
27
+ def initialize(check)
28
+ super(check)
29
+ @profiles = []
30
+ end
31
+
32
+ def check_name
33
+ __getobj__.class.name.demodulize
34
+ end
35
+
36
+ def add_profile(profile)
37
+ @profiles << profile
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,71 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/videos2/unsupported/check_result'
5
+
6
+ module EhbrsRubyUtils
7
+ module Videos2
8
+ module Unsupported
9
+ module CheckSupport
10
+ common_concern do
11
+ enable_simple_cache
12
+ enable_speaker
13
+ end
14
+
15
+ def aggressions_banner(title)
16
+ return if passed?
17
+
18
+ info title
19
+ pad_speaker do
20
+ unpassed_checks.each do |u|
21
+ info "* #{u.message}"
22
+ end
23
+ end
24
+ end
25
+
26
+ def ffmpeg_fix_args
27
+ unpassed_checks.flat_map do |check|
28
+ check.check.fix.if_present([]) { |v| v.ffmpeg_args(self) }
29
+ end
30
+ end
31
+
32
+ def passed?
33
+ unpassed_checks.none?
34
+ end
35
+
36
+ private
37
+
38
+ def unpassed_checks_uncached
39
+ checks.reject(&:passed?)
40
+ end
41
+
42
+ def checks_uncached
43
+ options.fetch(check_set_key).checks.map do |check|
44
+ ::EhbrsRubyUtils::Videos2::Unsupported::CheckResult.new(self, check)
45
+ end
46
+ rescue StandardError => e
47
+ raise "#{e.message} (Source: #{self})"
48
+ end
49
+
50
+ def fix_blocks_uncached
51
+ checks.reject(&:passed?).select { |c| c.check.fix.blank? }
52
+ end
53
+
54
+ def fixes_uncached
55
+ checks.reject(&:passed?).map { |c| c.check.fix }.compact_blank
56
+ end
57
+
58
+ def pad_speaker(&block)
59
+ ::EacRubyUtils::Speaker.context.on(::EacCli::Speaker.new(err_line_prefix: ' '), &block)
60
+ end
61
+
62
+ def new_padded_cli_speaker
63
+ ::EacCli::Speaker.new(
64
+ err_line_prefix("#{::EacRubyUtils::Speaker.context.optional_current
65
+ .if_present('') { |v| v.is_a?(::EacCli::Speaker) ? v.err_line_prefix : '' }} ")
66
+ )
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ module Videos2
5
+ module Unsupported
6
+ module Checks
7
+ class CodecExtraUnlisted
8
+ TYPE = :stream
9
+
10
+ common_constructor :codec, :listed_extras
11
+
12
+ def check(track)
13
+ return nil unless track.codec_name == codec
14
+ return nil if listed_extras.any? do |extra|
15
+ track.codec_tag_string.downcase.include?(extra.downcase)
16
+ end
17
+
18
+ "Not listed extra for codec \"#{codec}\" (Track: #{track}" \
19
+ ", listed extra: #{listed_extras})"
20
+ end
21
+
22
+ def fix
23
+ nil
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end