ehbrs-tools 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/Gemfile +13 -0
- data/exe/ehbrs +6 -0
- data/lib/ehbrs.rb +7 -0
- data/lib/ehbrs/executables.rb +28 -0
- data/lib/ehbrs/tools.rb +9 -0
- data/lib/ehbrs/tools/runner.rb +35 -0
- data/lib/ehbrs/tools/runner/vg.rb +26 -0
- data/lib/ehbrs/tools/runner/vg/ips.rb +90 -0
- data/lib/ehbrs/tools/runner/videos.rb +25 -0
- data/lib/ehbrs/tools/runner/videos/unsupported.rb +65 -0
- data/lib/ehbrs/tools/version.rb +7 -0
- data/lib/ehbrs/videos.rb +9 -0
- data/lib/ehbrs/videos/convert_job.rb +99 -0
- data/lib/ehbrs/videos/file.rb +70 -0
- data/lib/ehbrs/videos/profiles/base.rb +35 -0
- data/lib/ehbrs/videos/profiles/same_quality.rb +21 -0
- data/lib/ehbrs/videos/track.rb +27 -0
- data/lib/ehbrs/videos/unsupported/check_result.rb +24 -0
- data/lib/ehbrs/videos/unsupported/check_set.rb +43 -0
- data/lib/ehbrs/videos/unsupported/check_support.rb +68 -0
- data/lib/ehbrs/videos/unsupported/checks.rb +13 -0
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +27 -0
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +26 -0
- data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +23 -0
- data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +25 -0
- data/lib/ehbrs/videos/unsupported/checks/invalid_extension.rb +25 -0
- data/lib/ehbrs/videos/unsupported/file.rb +50 -0
- data/lib/ehbrs/videos/unsupported/file/fix.rb +45 -0
- data/lib/ehbrs/videos/unsupported/fix_profile.rb +56 -0
- data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +36 -0
- data/lib/ehbrs/videos/unsupported/fixes/supported_container.rb +17 -0
- data/lib/ehbrs/videos/unsupported/profiles.rb +13 -0
- data/lib/ehbrs/videos/unsupported/profiles/base.rb +102 -0
- data/lib/ehbrs/videos/unsupported/profiles/philco.rb +27 -0
- data/lib/ehbrs/videos/unsupported/profiles/samsung.rb +32 -0
- data/lib/ehbrs/videos/unsupported/search.rb +72 -0
- data/lib/ehbrs/videos/unsupported/track.rb +32 -0
- data/vendor/eac_cli/Gemfile +5 -0
- data/vendor/eac_cli/eac_cli.gemspec +18 -0
- data/vendor/eac_cli/lib/eac_cli.rb +7 -0
- data/vendor/eac_cli/lib/eac_cli/default_runner.rb +22 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +30 -0
- data/vendor/eac_cli/lib/eac_cli/runner/argument_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/runner/base_option.rb +22 -0
- data/vendor/eac_cli/lib/eac_cli/runner/boolean_option.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/runner/definition.rb +60 -0
- data/vendor/eac_cli/lib/eac_cli/runner/docopt_doc.rb +65 -0
- data/vendor/eac_cli/lib/eac_cli/runner/positional_argument.rb +15 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +5 -0
- data/vendor/eac_cli/spec/rubocop_spec.rb +7 -0
- data/vendor/eac_cli/spec/spec_helper.rb +100 -0
- data/vendor/eac_ruby_utils/Gemfile +16 -0
- data/vendor/eac_ruby_utils/MIT-LICENCE +16 -0
- data/vendor/eac_ruby_utils/README.rdoc +3 -0
- data/vendor/eac_ruby_utils/eac_ruby_utils.gemspec +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils.rb +23 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/arguments_consumer.rb +81 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +133 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs.rb +82 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +66 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +135 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +39 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +18 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_doc.rb +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_settings.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +139 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker.rb +134 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/_class_methods.rb +39 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/list.rb +63 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/speaker/node.rb +25 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/contextualizable.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/core_ext.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs.rb +23 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb +28 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +155 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +46 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb +51 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/file.rb +22 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/local_env.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/process.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env.rb +72 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_cache.rb +53 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/filesystem_traverser.rb +56 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable.rb +17 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/class_methods.rb +14 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/instance_methods.rb +30 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/integer_list.rb +23 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +89 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/lists.rb +61 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/string_list.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +38 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/on_clean_ruby_environment.rb +23 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/options_consumer.rb +62 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patch.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/class/common_constructor.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/options_consumer.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/sym_keys_hash.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/console_speaker.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/listable.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/simple_cache.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb +14 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_present.rb +12 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +16 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +95 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +11 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/conditional.rb +38 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/rspec/stubbed_ssh.rb +44 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/settings_provider.rb +65 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +42 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/directory.rb +104 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/file.rb +101 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/searcher.rb +55 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +5 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +13 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/arguments_consumer_spec.rb +17 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +36 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +31 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/configs_spec.rb +14 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/docopt_runner_spec.rb +136 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/console/speaker_spec.rb +36 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/executable_spec.rb +33 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/envs/ssh_env_spec.rb +25 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/filesystem_cache_spec.rb +32 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/listable_spec.rb +180 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/options_consumer_spec.rb +45 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/options_consumer_spec.rb +17 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/hash/sym_keys_hash_spec.rb +13 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/console_speaker_spec.rb +13 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/listable_spec.rb +13 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/module/simple_cache_spec.rb +13 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/if_present_spec.rb +13 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec.rb +23 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/object/template_spec_files/path/my_stub_with_template +1 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +49 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/settings_provider_spec.rb +46 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/simple_cache_spec.rb +102 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec.rb +34 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/expected_content +2 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec_files/source.template +2 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec.rb +30 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file1.template +1 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path1/subdir1/file2 +1 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/searcher_spec_files/path2/subdir1/file3.template +1 -0
- data/vendor/eac_ruby_utils/spec/locales/pt-BR.yml +38 -0
- data/vendor/eac_ruby_utils/spec/spec_helper.rb +12 -0
- metadata +227 -0
@@ -0,0 +1,50 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs/videos/file'
|
4
|
+
require 'ehbrs/videos/unsupported/file/fix'
|
5
|
+
require 'ehbrs/videos/unsupported/check_support'
|
6
|
+
require 'ehbrs/videos/unsupported/track'
|
7
|
+
|
8
|
+
module Ehbrs
|
9
|
+
module Videos
|
10
|
+
module Unsupported
|
11
|
+
class File < ::Ehbrs::Videos::File
|
12
|
+
include ::Ehbrs::Videos::Unsupported::CheckSupport
|
13
|
+
include ::Ehbrs::Videos::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
|
+
def tracks_uncached
|
45
|
+
super.map { |t| ::Ehbrs::Videos::Unsupported::Track.new(self, t) }
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs/videos/convert_job'
|
4
|
+
require 'ehbrs/videos/file'
|
5
|
+
require 'ehbrs/videos/unsupported/fix_profile'
|
6
|
+
|
7
|
+
module Ehbrs
|
8
|
+
module Videos
|
9
|
+
module Unsupported
|
10
|
+
class File < ::Ehbrs::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
|
+
::Ehbrs::Videos::Unsupported::FixProfile.new(self)
|
34
|
+
end
|
35
|
+
|
36
|
+
def fix
|
37
|
+
job = ::Ehbrs::Videos::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,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs/videos/profiles/same_quality'
|
4
|
+
|
5
|
+
module Ehbrs
|
6
|
+
module Videos
|
7
|
+
module Unsupported
|
8
|
+
class FixProfile
|
9
|
+
include ::Ehbrs::Videos::Profiles::SameQuality
|
10
|
+
|
11
|
+
common_constructor :video
|
12
|
+
set_callback :swap, :after do
|
13
|
+
video.all_fixes.each do |fix|
|
14
|
+
next unless fix.respond_to?(:after_swap)
|
15
|
+
|
16
|
+
fix.after_swap(self)
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def name
|
21
|
+
"fix_for_#{::File.basename(video.file)}"
|
22
|
+
end
|
23
|
+
|
24
|
+
def ffmpeg_args
|
25
|
+
r = fix_args
|
26
|
+
r += container_fix_args unless r.include?('-f')
|
27
|
+
r + super
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def fix_args
|
33
|
+
['-c', 'copy'] + video.ffmpeg_fix_args +
|
34
|
+
video.tracks.flat_map(&:ffmpeg_fix_args)
|
35
|
+
end
|
36
|
+
|
37
|
+
def track_fix_args(track)
|
38
|
+
["#{track_codec_option_by_type(track.type)}:#{track.number}",
|
39
|
+
track.passed? ? 'copy' : track_codec_fix_by_type(track.type)]
|
40
|
+
end
|
41
|
+
|
42
|
+
def track_codec_option_by_type(track_type)
|
43
|
+
TRACK_TYPE_OPTIONS.fetch(track_type)
|
44
|
+
end
|
45
|
+
|
46
|
+
def track_codec_fix_by_type(track_type)
|
47
|
+
TRACK_TYPE_FIX_CODECS.fetch(track_type)
|
48
|
+
end
|
49
|
+
|
50
|
+
def container_fix_args
|
51
|
+
['-f', ::Ehbrs::Videos::Unsupported::Fixes::SupportedContainer::FIX_FORMAT]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ehbrs
|
4
|
+
module Videos
|
5
|
+
module Unsupported
|
6
|
+
module Fixes
|
7
|
+
class SupportedCodec
|
8
|
+
TRACK_TYPE_OPTIONS = {
|
9
|
+
'Audio' => '-acodec',
|
10
|
+
'Video' => '-vcodec',
|
11
|
+
'Subtitle' => '-scodec'
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
TRACK_TYPE_FIX_CODECS = {
|
15
|
+
'Audio' => 'aac',
|
16
|
+
'Video' => 'libx264',
|
17
|
+
'Subtitle' => 'ass'
|
18
|
+
}.freeze
|
19
|
+
|
20
|
+
def ffmpeg_args(track)
|
21
|
+
["#{track_codec_option_by_type(track.type)}:#{track.number}",
|
22
|
+
track_codec_fix_by_type(track.type)]
|
23
|
+
end
|
24
|
+
|
25
|
+
def track_codec_option_by_type(track_type)
|
26
|
+
TRACK_TYPE_OPTIONS.fetch(track_type)
|
27
|
+
end
|
28
|
+
|
29
|
+
def track_codec_fix_by_type(track_type)
|
30
|
+
TRACK_TYPE_FIX_CODECS.fetch(track_type)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Ehbrs
|
4
|
+
module Videos
|
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/videos/unsupported/checks/#{name}"
|
19
|
+
added_checks << check_path.camelize.constantize.new(*args)
|
20
|
+
end
|
21
|
+
|
22
|
+
def file_checks
|
23
|
+
added_checks
|
24
|
+
end
|
25
|
+
|
26
|
+
def track_checks
|
27
|
+
[unlisted_codec_check] + unsupported_codec_checks +
|
28
|
+
supported_codecs.flat_map { |codec| codec_extra_checks(codec) }
|
29
|
+
end
|
30
|
+
|
31
|
+
def codec_extra_checks(codec)
|
32
|
+
codec_unlisted_extra_check(codec).if_present([]) { |v| [v] } +
|
33
|
+
codec_unsupported_extras(codec).map do |extra|
|
34
|
+
Ehbrs::Videos::Unsupported::Checks::CodecExtraUnsupported.new(codec, extra)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def codec_unlisted_extra_check(codec)
|
39
|
+
extras = codec_unsupported_extras(codec) + codec_supported_extras(codec)
|
40
|
+
return nil unless extras.any?
|
41
|
+
|
42
|
+
Ehbrs::Videos::Unsupported::Checks::CodecExtraUnlisted.new(
|
43
|
+
codec, extras.sort.uniq
|
44
|
+
)
|
45
|
+
end
|
46
|
+
|
47
|
+
def name
|
48
|
+
self.class.name.demodulize.underscore
|
49
|
+
end
|
50
|
+
|
51
|
+
def to_s
|
52
|
+
name
|
53
|
+
end
|
54
|
+
|
55
|
+
def unsupported_codec_checks
|
56
|
+
unsupported_codecs.map do |codec|
|
57
|
+
Ehbrs::Videos::Unsupported::Checks::CodecUnsupported.new(codec)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def unsupported_codecs_uncached
|
62
|
+
codecs_by_constant('unsupported')
|
63
|
+
end
|
64
|
+
|
65
|
+
def unlisted_codec_check
|
66
|
+
::Ehbrs::Videos::Unsupported::Checks::CodecUnlisted.new(
|
67
|
+
(supported_codecs + unsupported_codecs).sort.uniq
|
68
|
+
)
|
69
|
+
end
|
70
|
+
|
71
|
+
def supported_codecs_uncached
|
72
|
+
codecs_by_constant('supported')
|
73
|
+
end
|
74
|
+
|
75
|
+
def codecs_by_constant(middle)
|
76
|
+
CONSTANT_PREFIXES.inject([]) { |a, e| a + codecs_by_prefix(e, middle) }
|
77
|
+
end
|
78
|
+
|
79
|
+
def codecs_by_prefix(prefix, middle)
|
80
|
+
self.class.const_get("#{prefix}_#{middle}_codecs".upcase)
|
81
|
+
rescue NameError
|
82
|
+
[]
|
83
|
+
end
|
84
|
+
|
85
|
+
def codec_extras(codec, suffix)
|
86
|
+
self.class.const_get("#{codec}_extra_#{suffix}".upcase)
|
87
|
+
rescue NameError
|
88
|
+
[]
|
89
|
+
end
|
90
|
+
|
91
|
+
def codec_unsupported_extras(codec)
|
92
|
+
codec_extras(codec, 'unsupported')
|
93
|
+
end
|
94
|
+
|
95
|
+
def codec_supported_extras(codec)
|
96
|
+
codec_extras(codec, 'supported')
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs/videos/unsupported/profiles/base'
|
4
|
+
|
5
|
+
module Ehbrs
|
6
|
+
module Videos
|
7
|
+
module Unsupported
|
8
|
+
module Profiles
|
9
|
+
class Philco < ::Ehbrs::Videos::Unsupported::Profiles::Base
|
10
|
+
AUDIO_SUPPORTED_CODECS = %w[aac ac3 eac3 mp3].freeze
|
11
|
+
AUDIO_UNSUPPORTED_CODECS = %w[dts].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 subrip].freeze
|
17
|
+
SUBTITLE_UNSUPPORTED_CODECS = %w[mov].freeze
|
18
|
+
|
19
|
+
OTHER_SUPPORTED_CODECS = %w[ttf].freeze
|
20
|
+
|
21
|
+
MPEG4_EXTRA_SUPPORTED = %w[xvid].freeze
|
22
|
+
MPEG4_EXTRA_UNSUPPORTED = %w[dx50].freeze
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ehbrs/videos/unsupported/checks/invalid_extension'
|
4
|
+
require 'ehbrs/videos/unsupported/profiles/base'
|
5
|
+
|
6
|
+
module Ehbrs
|
7
|
+
module Videos
|
8
|
+
module Unsupported
|
9
|
+
module Profiles
|
10
|
+
class Samsung < ::Ehbrs::Videos::Unsupported::Profiles::Base
|
11
|
+
AUDIO_SUPPORTED_CODECS = %w[aac ac3 dts eac3 mp3 vorbis].freeze
|
12
|
+
AUDIO_UNSUPPORTED_CODECS = %w[].freeze
|
13
|
+
|
14
|
+
VIDEO_SUPPORTED_CODECS = %w[h264 mpeg4 hevc].freeze
|
15
|
+
VIDEO_UNSUPPORTED_CODECS = %w[].freeze
|
16
|
+
|
17
|
+
SUBTITLE_SUPPORTED_CODECS = %w[ass dvd subrip].freeze
|
18
|
+
SUBTITLE_UNSUPPORTED_CODECS = %w[mov].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
|
+
add_check('invalid_extension', '.m4v')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/filesystem_traverser'
|
4
|
+
require 'eac_ruby_utils/core_ext'
|
5
|
+
require 'ehbrs/videos/unsupported/file'
|
6
|
+
|
7
|
+
module Ehbrs
|
8
|
+
module Videos
|
9
|
+
module Unsupported
|
10
|
+
class Search
|
11
|
+
enable_console_speaker
|
12
|
+
|
13
|
+
VALID_EXTENSIONS = %w[.avi .mp4 .mkv .m4v].freeze
|
14
|
+
|
15
|
+
def initialize(root, file_options)
|
16
|
+
@root = root
|
17
|
+
@file_options = file_options
|
18
|
+
@files = 0
|
19
|
+
@videos = 0
|
20
|
+
@unsupported = 0
|
21
|
+
run
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def run
|
27
|
+
start_banner
|
28
|
+
traverser = ::EacRubyUtils::FilesystemTraverser.new
|
29
|
+
traverser.recursive = true
|
30
|
+
traverser.check_file = method(:check_file)
|
31
|
+
traverser.check_path(@root)
|
32
|
+
end_banner
|
33
|
+
end
|
34
|
+
|
35
|
+
def recursive?
|
36
|
+
true
|
37
|
+
end
|
38
|
+
|
39
|
+
def check_file(file)
|
40
|
+
@files += 1
|
41
|
+
check_video(file) if video_file?(file)
|
42
|
+
end
|
43
|
+
|
44
|
+
def check_video(file)
|
45
|
+
@videos += 1
|
46
|
+
v = ::Ehbrs::Videos::Unsupported::File.new(file, @file_options)
|
47
|
+
return if v.all_passed?
|
48
|
+
|
49
|
+
@unsupported += 1
|
50
|
+
v.banner
|
51
|
+
v.check_fix
|
52
|
+
end
|
53
|
+
|
54
|
+
def start_banner
|
55
|
+
infom "Searching in: \"#{@root}\""
|
56
|
+
end
|
57
|
+
|
58
|
+
def end_banner
|
59
|
+
infom "Unsupported/Videos/Files: #{@unsupported}/#{@videos}/#{@files}"
|
60
|
+
end
|
61
|
+
|
62
|
+
def video_file?(path)
|
63
|
+
valid_extensions.include?(::File.extname(path))
|
64
|
+
end
|
65
|
+
|
66
|
+
def valid_extensions
|
67
|
+
self.class::VALID_EXTENSIONS
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|