ehbrs-tools 0.16.1 → 0.17.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs/cooking_book.rb +9 -0
- data/lib/ehbrs/cooking_book/build.rb +45 -0
- data/lib/ehbrs/cooking_book/build/base_page.rb +43 -0
- data/lib/ehbrs/cooking_book/build/index_page.rb +26 -0
- data/lib/ehbrs/cooking_book/build/recipe_page.rb +27 -0
- data/lib/ehbrs/cooking_book/project.rb +25 -0
- data/lib/ehbrs/cooking_book/recipe.rb +37 -0
- data/lib/ehbrs/cooking_book/recipe/ingredient.rb +21 -0
- data/lib/ehbrs/cooking_book/recipe/measure.rb +60 -0
- data/lib/ehbrs/cooking_book/recipe/part.rb +32 -0
- data/lib/ehbrs/patches/module/erb_template.rb +11 -0
- data/lib/ehbrs/patches/object/erb_template.rb +9 -0
- data/lib/ehbrs/patches/object/template.rb +7 -0
- data/lib/ehbrs/runner.rb +6 -13
- data/lib/ehbrs/runner/cooking_book.rb +30 -0
- data/lib/ehbrs/runner/cooking_book/build.rb +32 -0
- data/lib/ehbrs/runner/videos/probe.rb +3 -3
- data/lib/ehbrs/tools/application.rb +13 -0
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/videos/file.rb +4 -8
- data/lib/ehbrs/videos/track.rb +5 -13
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +3 -1
- data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +3 -1
- data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +4 -2
- data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +3 -1
- data/lib/ehbrs/videos/unsupported/checks/invalid_extension.rb +2 -0
- data/lib/ehbrs/videos/unsupported/fix_profile.rb +0 -13
- data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +10 -10
- data/lib/ehbrs/videos/unsupported/profiles/base.rb +17 -3
- data/lib/ehbrs/videos/unsupported/profiles/philco.rb +5 -4
- data/template/ehbrs/cooking_book/build/base_page/layout.html.erb +20 -0
- data/template/ehbrs/cooking_book/build/index_page/inner.html.erb +6 -0
- data/template/ehbrs/cooking_book/build/recipe_page/inner.html.erb +6 -0
- data/template/ehbrs/cooking_book/build/recipe_page/part.html.erb +27 -0
- data/vendor/aranha-parsers/lib/aranha/parsers/spec/source_target_fixtures_example.rb +10 -2
- data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +1 -1
- data/vendor/eac_cli/eac_cli.gemspec +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition.rb +34 -39
- data/vendor/eac_cli/lib/eac_cli/definition/alternative.rb +83 -0
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb +18 -40
- data/vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb +50 -0
- data/vendor/eac_cli/lib/eac_cli/parser.rb +23 -3
- data/vendor/eac_cli/lib/eac_cli/parser/alternative.rb +92 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb +17 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb +24 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb +58 -0
- data/vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb +30 -0
- data/vendor/eac_cli/lib/eac_cli/runner.rb +12 -4
- data/vendor/eac_cli/lib/eac_cli/runner/exit.rb +13 -0
- data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +18 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +6 -1
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb +14 -0
- data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +10 -0
- data/vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb +140 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +17 -5
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb +42 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb +53 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +29 -1
- data/vendor/eac_docker/lib/eac_docker/container.rb +24 -0
- data/vendor/eac_docker/lib/eac_docker/images/coded.rb +39 -0
- data/vendor/eac_docker/lib/eac_docker/images/templatized.rb +26 -0
- data/vendor/eac_docker/lib/eac_docker/registry.rb +17 -0
- data/vendor/eac_docker/lib/eac_docker/version.rb +1 -1
- data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec.rb +12 -0
- data/vendor/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile +1 -0
- data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb +17 -0
- data/vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile +1 -0
- data/vendor/eac_ruby_base0/Gemfile +5 -0
- data/vendor/eac_ruby_base0/eac_ruby_base0.gemspec +20 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0.rb +7 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb +69 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb +54 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb +27 -0
- data/vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb +5 -0
- data/vendor/eac_ruby_base0/spec/rubocop_spec.rb +7 -0
- data/vendor/eac_ruby_base0/spec/spec_helper.rb +100 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb +60 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +2 -50
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb +52 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb +41 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb +6 -50
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_initialize.rb +29 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/instance_initialize.rb +53 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/super_args.rb +54 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +10 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +4 -6
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb +33 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb +24 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +0 -21
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb +10 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/template.rb +1 -8
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/pathname/basename_sub.rb +2 -2
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +7 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb +11 -2
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb +28 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb +40 -17
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_constructor_spec.rb +96 -8
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +12 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +30 -2
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb +91 -0
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb +51 -0
- metadata +89 -13
- data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +0 -68
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +0 -38
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +0 -77
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/file.rb +0 -31
- data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/info.rb +0 -21
@@ -9,34 +9,57 @@ RSpec.describe ::EacRubyUtils::CommonConcern do
|
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
let(:stub_module) do
|
13
|
+
::Module.new do
|
14
|
+
module ClassMethods # rubocop:disable RSpec/LeakyConstantDeclaration
|
15
|
+
def my_class_method
|
16
|
+
'class'
|
17
|
+
end
|
16
18
|
end
|
17
|
-
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
module InstanceMethods # rubocop:disable RSpec/LeakyConstantDeclaration
|
21
|
+
def my_instance_method
|
22
|
+
'from_module'
|
23
|
+
end
|
22
24
|
end
|
23
25
|
end
|
24
26
|
end
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
let(:stub_class) do
|
29
|
+
::Class.new do
|
30
|
+
class << self
|
31
|
+
attr_accessor :valor
|
32
|
+
end
|
33
|
+
|
34
|
+
def my_instance_method
|
35
|
+
'from_class'
|
36
|
+
end
|
29
37
|
end
|
30
38
|
end
|
31
39
|
|
32
|
-
let(:
|
40
|
+
let(:stub_class_instance) { stub_class.new }
|
33
41
|
|
34
42
|
before do
|
35
|
-
instance.setup(
|
36
|
-
MyClass.include MyModule
|
43
|
+
instance.setup(stub_module)
|
37
44
|
end
|
38
45
|
|
39
|
-
|
40
|
-
|
41
|
-
|
46
|
+
context 'when included' do
|
47
|
+
before do
|
48
|
+
stub_class.include stub_module
|
49
|
+
end
|
50
|
+
|
51
|
+
it { expect(stub_class_instance.my_instance_method).to eq('from_class') }
|
52
|
+
it { expect(stub_class_instance.class.my_class_method).to eq('class') }
|
53
|
+
it { expect(stub_class_instance.class.valor).to eq('changed') }
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when prepended' do
|
57
|
+
before do
|
58
|
+
stub_class.prepend stub_module
|
59
|
+
end
|
60
|
+
|
61
|
+
it { expect(stub_class_instance.my_instance_method).to eq('from_module') }
|
62
|
+
it { expect(stub_class_instance.class.my_class_method).to eq('class') }
|
63
|
+
it { expect(stub_class_instance.class.valor).to eq('changed') }
|
64
|
+
end
|
42
65
|
end
|
@@ -3,34 +3,122 @@
|
|
3
3
|
require 'eac_ruby_utils/common_constructor'
|
4
4
|
|
5
5
|
RSpec.describe ::EacRubyUtils::CommonConstructor do
|
6
|
-
ARG_LIST = %i[a b c d].freeze
|
6
|
+
ARG_LIST = %i[a b c d].freeze # rubocop:disable RSpec/LeakyConstantDeclaration
|
7
|
+
|
7
8
|
let(:instance) do
|
8
9
|
described_class.new(*ARG_LIST, default: %w[Vcc Vd]) do
|
9
10
|
@z = 'Vz'
|
10
11
|
end
|
11
12
|
end
|
12
13
|
|
13
|
-
|
14
|
-
|
14
|
+
let(:a_class) do
|
15
|
+
::Class.new do
|
16
|
+
attr_reader :z
|
17
|
+
end
|
15
18
|
end
|
16
19
|
|
17
|
-
let(:
|
20
|
+
let(:a_class_instance) { a_class.new('Va', 'Vb', 'Vc') }
|
18
21
|
|
19
22
|
before do
|
20
|
-
instance.setup_class(
|
23
|
+
instance.setup_class(a_class)
|
21
24
|
end
|
22
25
|
|
23
|
-
it { expect(
|
26
|
+
it { expect(a_class_instance.z).to eq('Vz') }
|
24
27
|
|
25
28
|
ARG_LIST.each do |attr|
|
26
29
|
expected_value = "V#{attr}"
|
27
30
|
it "attribute \"#{attr}\" equal to \"#{expected_value}\"" do
|
28
|
-
expect(
|
31
|
+
expect(a_class_instance.send(attr)).to eq(expected_value)
|
29
32
|
end
|
30
33
|
|
31
34
|
[false, true].each do |include_all|
|
32
35
|
it "respond_to?('#{attr}', #{include_all}) == #{include_all}" do
|
33
|
-
expect(
|
36
|
+
expect(a_class_instance.respond_to?("#{attr}=", include_all)).to eq(include_all)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'with super class' do
|
42
|
+
let(:super_class) do
|
43
|
+
::Class.new do
|
44
|
+
attr_reader :super_a, :super_b
|
45
|
+
|
46
|
+
def initialize(a, b) # rubocop:disable Naming/MethodParameterName
|
47
|
+
@super_a = a
|
48
|
+
@super_b = b
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
let(:sub_class) do
|
54
|
+
sub_constructor.setup_class(::Class.new(super_class))
|
55
|
+
end
|
56
|
+
|
57
|
+
let(:sub_object) { sub_class.new(1, 2, 3, 4) }
|
58
|
+
|
59
|
+
context 'with super_args parameter' do
|
60
|
+
let(:sub_constructor) do
|
61
|
+
described_class.new(:c, :a, :b, :d, super_args: -> { [c, a] })
|
62
|
+
end
|
63
|
+
|
64
|
+
it { expect(sub_object.a).to eq(2) }
|
65
|
+
it { expect(sub_object.b).to eq(3) }
|
66
|
+
it { expect(sub_object.c).to eq(1) }
|
67
|
+
it { expect(sub_object.d).to eq(4) }
|
68
|
+
it { expect(sub_object.super_a).to eq(1) }
|
69
|
+
it { expect(sub_object.super_b).to eq(2) }
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'without super_args parameter' do
|
73
|
+
let(:sub_constructor) do
|
74
|
+
described_class.new(:c, :a, :b, :d)
|
75
|
+
end
|
76
|
+
|
77
|
+
it { expect(sub_object.a).to eq(2) }
|
78
|
+
it { expect(sub_object.b).to eq(3) }
|
79
|
+
it { expect(sub_object.c).to eq(1) }
|
80
|
+
it { expect(sub_object.d).to eq(4) }
|
81
|
+
it { expect(sub_object.super_a).to eq(2) }
|
82
|
+
it { expect(sub_object.super_b).to eq(3) }
|
83
|
+
end
|
84
|
+
|
85
|
+
context 'with undefined super arguments' do
|
86
|
+
let(:sub_constructor) do
|
87
|
+
described_class.new(:x, :y, :w, :a)
|
88
|
+
end
|
89
|
+
|
90
|
+
it do
|
91
|
+
expect { sub_object }.to raise_error(::ArgumentError)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
context 'with class hierarchy mixed with and without common_constructor' do
|
97
|
+
let(:klass_0) do
|
98
|
+
described_class.new(:a_param).setup_class(::Class.new)
|
99
|
+
end
|
100
|
+
|
101
|
+
let(:klass_1) do
|
102
|
+
::Class.new(klass_0) do
|
103
|
+
def initialize(a_param)
|
104
|
+
super(a_param)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
let(:klass_2) do
|
110
|
+
::Class.new(klass_1)
|
111
|
+
end
|
112
|
+
|
113
|
+
let(:klass_3) do
|
114
|
+
described_class.new(:a_param).setup_class(::Class.new(klass_2))
|
115
|
+
end
|
116
|
+
|
117
|
+
4.times.each do |i|
|
118
|
+
context "wit #{i}-th class" do
|
119
|
+
let(:class_instance) { send("klass_#{i}").new(:a) }
|
120
|
+
|
121
|
+
it { expect(class_instance.a_param).to eq(:a) }
|
34
122
|
end
|
35
123
|
end
|
36
124
|
end
|
@@ -3,7 +3,8 @@
|
|
3
3
|
require 'eac_ruby_utils/struct'
|
4
4
|
|
5
5
|
RSpec.describe ::EacRubyUtils::Struct do
|
6
|
-
let(:instance) { described_class.new(a
|
6
|
+
let(:instance) { described_class.new('a' => 1, b: '') }
|
7
|
+
let(:other) { described_class.new('a' => 'm1', c: 'm2') }
|
7
8
|
|
8
9
|
describe '#[]' do
|
9
10
|
it { expect(instance[:a]).to eq(1) }
|
@@ -35,6 +36,12 @@ RSpec.describe ::EacRubyUtils::Struct do
|
|
35
36
|
it { expect { instance.fetch('c?') }.to raise_error(::KeyError) }
|
36
37
|
end
|
37
38
|
|
39
|
+
describe '#merge' do
|
40
|
+
let(:merged) { instance.merge(other) }
|
41
|
+
|
42
|
+
it { expect(merged.to_h).to eq(a: 'm1', b: '', c: 'm2') }
|
43
|
+
end
|
44
|
+
|
38
45
|
describe '#property_method' do
|
39
46
|
it { expect(instance.a).to eq(1) }
|
40
47
|
it { expect(instance.a?).to eq(true) }
|
@@ -43,4 +50,8 @@ RSpec.describe ::EacRubyUtils::Struct do
|
|
43
50
|
it { expect { instance.c }.to raise_error(::NoMethodError) }
|
44
51
|
it { expect { instance.c? }.to raise_error(::NoMethodError) }
|
45
52
|
end
|
53
|
+
|
54
|
+
describe '#to_h' do
|
55
|
+
it { expect(instance.to_h).to eq(a: 1, b: '') }
|
56
|
+
end
|
46
57
|
end
|
@@ -1,11 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/executables'
|
5
|
+
require 'ehbrs_ruby_utils/videos/stream'
|
6
|
+
require 'json'
|
4
7
|
|
5
8
|
module EhbrsRubyUtils
|
6
9
|
module Videos
|
7
|
-
|
8
|
-
|
10
|
+
class Container
|
11
|
+
enable_simple_cache
|
12
|
+
common_constructor :path do
|
13
|
+
self.path = path.to_pathname
|
14
|
+
end
|
15
|
+
|
16
|
+
::EhbrsRubyUtils::Videos::Stream.lists.codec_type.each_value do |stream_type|
|
17
|
+
define_method stream_type.to_s.pluralize do
|
18
|
+
streams.select { |stream| stream.codec_type == stream_type }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def probe_data_uncached
|
25
|
+
::JSON.parse(
|
26
|
+
::EhbrsRubyUtils::Executables.ffprobe.command(
|
27
|
+
'-hide_banner', '-print_format', 'json', '-show_format', '-show_streams', path
|
28
|
+
).execute!
|
29
|
+
).deep_symbolize_keys.freeze
|
30
|
+
end
|
31
|
+
|
32
|
+
def streams_uncached
|
33
|
+
probe_data.fetch(:streams).map do |stream_ffprobe_data|
|
34
|
+
::EhbrsRubyUtils::Videos::Stream.new(stream_ffprobe_data)
|
35
|
+
end
|
36
|
+
end
|
9
37
|
end
|
10
38
|
end
|
11
39
|
end
|
@@ -0,0 +1,91 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs/executables'
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
module EhbrsRubyUtils
|
8
|
+
module Videos
|
9
|
+
class ConvertJob
|
10
|
+
FORMATS_TO_EXTENSIONS = {
|
11
|
+
'matroska' => '.mkv'
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
enable_console_speaker
|
15
|
+
enable_simple_cache
|
16
|
+
common_constructor :input, :ffmpeg_convert_args do
|
17
|
+
self.input = input.to_pathname.expand_path
|
18
|
+
raise "Input file \"#{input}\" does not exist or is not a file" unless input.file?
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
if converted.exist?
|
23
|
+
warn("Converted file already exist: \"#{converted}\"")
|
24
|
+
else
|
25
|
+
convert
|
26
|
+
swap
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def target
|
31
|
+
input.dirname.join("#{input.basename('.*')}#{target_extension}")
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
def command_args_uncached
|
37
|
+
r = ['-i', input] + ffmpeg_convert_args
|
38
|
+
r += ['-f', format_by_input] if format_by_args.blank?
|
39
|
+
r + [converting]
|
40
|
+
end
|
41
|
+
|
42
|
+
def convert
|
43
|
+
infov 'Input', input
|
44
|
+
infov 'Target', target
|
45
|
+
infov 'Convert args', command_args.shelljoin
|
46
|
+
::Ehbrs::Executables.ffmpeg.command.append(command_args).system!
|
47
|
+
end
|
48
|
+
|
49
|
+
def format_by_args_uncached
|
50
|
+
ffmpeg_convert_args.rindex('-f').if_present do |option_index|
|
51
|
+
ffmpeg_convert_args[option_index + 1]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def format_by_input
|
56
|
+
FORMATS_TO_EXTENSIONS.invert[target_extension_by_input].if_present { |v| return v }
|
57
|
+
|
58
|
+
raise 'Unknonwn target format'
|
59
|
+
end
|
60
|
+
|
61
|
+
def format_to_extension(format)
|
62
|
+
FORMATS_TO_EXTENSIONS[format].if_present(".#{format}")
|
63
|
+
end
|
64
|
+
|
65
|
+
def swap
|
66
|
+
::FileUtils.mv(input, converted)
|
67
|
+
::FileUtils.mv(converting, target)
|
68
|
+
end
|
69
|
+
|
70
|
+
def converting
|
71
|
+
target.basename_sub { |b| "#{b}.converting" }
|
72
|
+
end
|
73
|
+
|
74
|
+
def converted
|
75
|
+
input.basename_sub { |b| "#{b}.converted" }
|
76
|
+
end
|
77
|
+
|
78
|
+
def target_extension
|
79
|
+
target_extension_by_args || target_extension_by_input
|
80
|
+
end
|
81
|
+
|
82
|
+
def target_extension_by_args
|
83
|
+
format_by_args.if_present { |v| format_to_extension(v) }
|
84
|
+
end
|
85
|
+
|
86
|
+
def target_extension_by_input
|
87
|
+
::File.extname(input)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EhbrsRubyUtils
|
6
|
+
module Videos
|
7
|
+
class Stream
|
8
|
+
enable_simple_cache
|
9
|
+
enable_listable
|
10
|
+
|
11
|
+
lists.add_symbol :codec_type, :audio, :video, :subtitle, :data, :attachment
|
12
|
+
|
13
|
+
common_constructor :ffprobe_data do
|
14
|
+
self.ffprobe_data = ffprobe_data.symbolize_keys.freeze
|
15
|
+
self.class.lists.codec_type.value_validate!(codec_type)
|
16
|
+
end
|
17
|
+
|
18
|
+
lists.codec_type.each_value do |v|
|
19
|
+
define_method "#{v}?" do
|
20
|
+
codec_type == v
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def to_s
|
25
|
+
"#{index}|#{codec_type}|#{codec_name}|#{language}"
|
26
|
+
end
|
27
|
+
|
28
|
+
def to_h
|
29
|
+
ffprobe_data
|
30
|
+
end
|
31
|
+
|
32
|
+
%i[index codec_name codec_long_name].each do |method_name|
|
33
|
+
define_method method_name do
|
34
|
+
ffprobe_data.fetch(method_name)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def codec_type
|
39
|
+
ffprobe_data.fetch(:codec_type).to_sym
|
40
|
+
end
|
41
|
+
|
42
|
+
def tags
|
43
|
+
ffprobe_data[:tags].if_present({}, &:symbolize_keys)
|
44
|
+
end
|
45
|
+
|
46
|
+
def language
|
47
|
+
tags[:language]
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehbrs-tools
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Esquilo Azul Company
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: avm-tools
|
@@ -16,34 +16,54 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.82'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.
|
22
|
+
version: 0.82.1
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - "~>"
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.82'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.
|
32
|
+
version: 0.82.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: eac_cli
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.12'
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.12.4
|
43
|
+
type: :runtime
|
44
|
+
prerelease: false
|
45
|
+
version_requirements: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - "~>"
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0.12'
|
50
|
+
- - "~>"
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
version: 0.12.4
|
33
53
|
- !ruby/object:Gem::Dependency
|
34
54
|
name: eac_ruby_utils
|
35
55
|
requirement: !ruby/object:Gem::Requirement
|
36
56
|
requirements:
|
37
57
|
- - "~>"
|
38
58
|
- !ruby/object:Gem::Version
|
39
|
-
version: '0.
|
59
|
+
version: '0.55'
|
40
60
|
type: :runtime
|
41
61
|
prerelease: false
|
42
62
|
version_requirements: !ruby/object:Gem::Requirement
|
43
63
|
requirements:
|
44
64
|
- - "~>"
|
45
65
|
- !ruby/object:Gem::Version
|
46
|
-
version: '0.
|
66
|
+
version: '0.55'
|
47
67
|
- !ruby/object:Gem::Dependency
|
48
68
|
name: filesize
|
49
69
|
requirement: !ruby/object:Gem::Requirement
|
@@ -96,6 +116,16 @@ files:
|
|
96
116
|
- Gemfile
|
97
117
|
- exe/ehbrs
|
98
118
|
- lib/ehbrs.rb
|
119
|
+
- lib/ehbrs/cooking_book.rb
|
120
|
+
- lib/ehbrs/cooking_book/build.rb
|
121
|
+
- lib/ehbrs/cooking_book/build/base_page.rb
|
122
|
+
- lib/ehbrs/cooking_book/build/index_page.rb
|
123
|
+
- lib/ehbrs/cooking_book/build/recipe_page.rb
|
124
|
+
- lib/ehbrs/cooking_book/project.rb
|
125
|
+
- lib/ehbrs/cooking_book/recipe.rb
|
126
|
+
- lib/ehbrs/cooking_book/recipe/ingredient.rb
|
127
|
+
- lib/ehbrs/cooking_book/recipe/measure.rb
|
128
|
+
- lib/ehbrs/cooking_book/recipe/part.rb
|
99
129
|
- lib/ehbrs/executables.rb
|
100
130
|
- lib/ehbrs/fs.rb
|
101
131
|
- lib/ehbrs/fs/compressed_package.rb
|
@@ -106,7 +136,12 @@ files:
|
|
106
136
|
- lib/ehbrs/observers.rb
|
107
137
|
- lib/ehbrs/observers/base.rb
|
108
138
|
- lib/ehbrs/observers/with_persistence.rb
|
139
|
+
- lib/ehbrs/patches/module/erb_template.rb
|
140
|
+
- lib/ehbrs/patches/object/erb_template.rb
|
141
|
+
- lib/ehbrs/patches/object/template.rb
|
109
142
|
- lib/ehbrs/runner.rb
|
143
|
+
- lib/ehbrs/runner/cooking_book.rb
|
144
|
+
- lib/ehbrs/runner/cooking_book/build.rb
|
110
145
|
- lib/ehbrs/runner/finances.rb
|
111
146
|
- lib/ehbrs/runner/finances/bb_browser.rb
|
112
147
|
- lib/ehbrs/runner/fs.rb
|
@@ -132,6 +167,7 @@ files:
|
|
132
167
|
- lib/ehbrs/self/observers/used_space.rb
|
133
168
|
- lib/ehbrs/self/observers/with_persistence.rb
|
134
169
|
- lib/ehbrs/tools.rb
|
170
|
+
- lib/ehbrs/tools/application.rb
|
135
171
|
- lib/ehbrs/tools/version.rb
|
136
172
|
- lib/ehbrs/user_dirs.rb
|
137
173
|
- lib/ehbrs/vg.rb
|
@@ -182,6 +218,10 @@ files:
|
|
182
218
|
- lib/ehbrs/videos/unsupported/profiles/samsung.rb
|
183
219
|
- lib/ehbrs/videos/unsupported/search.rb
|
184
220
|
- lib/ehbrs/videos/unsupported/track.rb
|
221
|
+
- template/ehbrs/cooking_book/build/base_page/layout.html.erb
|
222
|
+
- template/ehbrs/cooking_book/build/index_page/inner.html.erb
|
223
|
+
- template/ehbrs/cooking_book/build/recipe_page/inner.html.erb
|
224
|
+
- template/ehbrs/cooking_book/build/recipe_page/part.html.erb
|
185
225
|
- vendor/aranha-parsers/Gemfile
|
186
226
|
- vendor/aranha-parsers/aranha-parsers.gemspec
|
187
227
|
- vendor/aranha-parsers/lib/aranha/parsers.rb
|
@@ -231,31 +271,40 @@ files:
|
|
231
271
|
- vendor/eac_cli/lib/eac_cli/core_ext.rb
|
232
272
|
- vendor/eac_cli/lib/eac_cli/default_runner.rb
|
233
273
|
- vendor/eac_cli/lib/eac_cli/definition.rb
|
274
|
+
- vendor/eac_cli/lib/eac_cli/definition/alternative.rb
|
234
275
|
- vendor/eac_cli/lib/eac_cli/definition/argument_option.rb
|
235
276
|
- vendor/eac_cli/lib/eac_cli/definition/base_option.rb
|
236
277
|
- vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb
|
237
278
|
- vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb
|
238
279
|
- vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb
|
239
280
|
- vendor/eac_cli/lib/eac_cli/docopt/doc_builder.rb
|
281
|
+
- vendor/eac_cli/lib/eac_cli/docopt/doc_builder/alternative.rb
|
240
282
|
- vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb
|
241
283
|
- vendor/eac_cli/lib/eac_cli/parser.rb
|
284
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative.rb
|
285
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/argv.rb
|
286
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/double_dash.rb
|
287
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/options.rb
|
288
|
+
- vendor/eac_cli/lib/eac_cli/parser/alternative/positionals.rb
|
242
289
|
- vendor/eac_cli/lib/eac_cli/parser/collector.rb
|
243
290
|
- vendor/eac_cli/lib/eac_cli/parser/error.rb
|
244
|
-
- vendor/eac_cli/lib/eac_cli/parser/options_collection.rb
|
245
|
-
- vendor/eac_cli/lib/eac_cli/parser/parse_result.rb
|
246
|
-
- vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb
|
247
291
|
- vendor/eac_cli/lib/eac_cli/patches.rb
|
248
292
|
- vendor/eac_cli/lib/eac_cli/patches/object.rb
|
249
293
|
- vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb
|
250
294
|
- vendor/eac_cli/lib/eac_cli/runner.rb
|
251
295
|
- vendor/eac_cli/lib/eac_cli/runner/context.rb
|
296
|
+
- vendor/eac_cli/lib/eac_cli/runner/exit.rb
|
252
297
|
- vendor/eac_cli/lib/eac_cli/runner_with.rb
|
253
298
|
- vendor/eac_cli/lib/eac_cli/runner_with/help.rb
|
254
299
|
- vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb
|
255
300
|
- vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb
|
256
301
|
- vendor/eac_cli/lib/eac_cli/version.rb
|
302
|
+
- vendor/eac_cli/spec/lib/eac_cli/definition/alternative_spec.rb
|
257
303
|
- vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb
|
304
|
+
- vendor/eac_cli/spec/lib/eac_cli/parser/alternative_spec.rb
|
258
305
|
- vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb
|
306
|
+
- vendor/eac_cli/spec/lib/eac_cli/runner_with/help_spec.rb
|
307
|
+
- vendor/eac_cli/spec/lib/eac_cli/runner_with/output_file_spec.rb
|
259
308
|
- vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb
|
260
309
|
- vendor/eac_cli/spec/rubocop_spec.rb
|
261
310
|
- vendor/eac_cli/spec/spec_helper.rb
|
@@ -266,23 +315,45 @@ files:
|
|
266
315
|
- vendor/eac_docker/lib/eac_docker/executables.rb
|
267
316
|
- vendor/eac_docker/lib/eac_docker/images.rb
|
268
317
|
- vendor/eac_docker/lib/eac_docker/images/base.rb
|
318
|
+
- vendor/eac_docker/lib/eac_docker/images/coded.rb
|
269
319
|
- vendor/eac_docker/lib/eac_docker/images/named.rb
|
320
|
+
- vendor/eac_docker/lib/eac_docker/images/templatized.rb
|
321
|
+
- vendor/eac_docker/lib/eac_docker/registry.rb
|
270
322
|
- vendor/eac_docker/lib/eac_docker/rspec.rb
|
271
323
|
- vendor/eac_docker/lib/eac_docker/version.rb
|
272
324
|
- vendor/eac_docker/spec/lib/eac_docker/executables_spec.rb
|
325
|
+
- vendor/eac_docker/spec/lib/eac_docker/images/coded_spec.rb
|
326
|
+
- vendor/eac_docker/spec/lib/eac_docker/images/coded_spec_files/image1/Dockerfile
|
327
|
+
- vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec.rb
|
328
|
+
- vendor/eac_docker/spec/lib/eac_docker/images/templatized_spec_files/stub_docker_image/Dockerfile
|
273
329
|
- vendor/eac_docker/spec/rubocop_spec.rb
|
274
330
|
- vendor/eac_docker/spec/spec_helper.rb
|
331
|
+
- vendor/eac_ruby_base0/Gemfile
|
332
|
+
- vendor/eac_ruby_base0/eac_ruby_base0.gemspec
|
333
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0.rb
|
334
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/application.rb
|
335
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/runner.rb
|
336
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/runner/test_all.rb
|
337
|
+
- vendor/eac_ruby_base0/lib/eac_ruby_base0/version.rb
|
338
|
+
- vendor/eac_ruby_base0/spec/rubocop_spec.rb
|
339
|
+
- vendor/eac_ruby_base0/spec/spec_helper.rb
|
275
340
|
- vendor/eac_ruby_utils/Gemfile
|
276
341
|
- vendor/eac_ruby_utils/MIT-LICENCE
|
277
342
|
- vendor/eac_ruby_utils/README.rdoc
|
278
343
|
- vendor/eac_ruby_utils/eac_ruby_utils.gemspec
|
279
344
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils.rb
|
345
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/abstract_methods.rb
|
280
346
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/arguments_consumer.rb
|
281
347
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb
|
282
348
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb
|
283
349
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/by_reference.rb
|
284
350
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb
|
351
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/class_setup.rb
|
352
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern/module_setup.rb
|
285
353
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor.rb
|
354
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/class_initialize.rb
|
355
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/instance_initialize.rb
|
356
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/common_constructor/super_args.rb
|
286
357
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/configs.rb
|
287
358
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb
|
288
359
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb
|
@@ -308,6 +379,8 @@ files:
|
|
308
379
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs.rb
|
309
380
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/base_env.rb
|
310
381
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb
|
382
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/concat.rb
|
383
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/envvars.rb
|
311
384
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb
|
312
385
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/executable.rb
|
313
386
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/file.rb
|
@@ -362,6 +435,7 @@ files:
|
|
362
435
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/options_consumer.rb
|
363
436
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/hash/sym_keys_hash.rb
|
364
437
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module.rb
|
438
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/abstract_methods.rb
|
365
439
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/common_concern.rb
|
366
440
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/console_speaker.rb
|
367
441
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb
|
@@ -369,6 +443,7 @@ files:
|
|
369
443
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/patch.rb
|
370
444
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/require_sub.rb
|
371
445
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/simple_cache.rb
|
446
|
+
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/template.rb
|
372
447
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object.rb
|
373
448
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/asserts.rb
|
374
449
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb
|
@@ -411,6 +486,7 @@ files:
|
|
411
486
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/hash.rb
|
412
487
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb
|
413
488
|
- vendor/eac_ruby_utils/lib/eac_ruby_utils/yaml.rb
|
489
|
+
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/abstract_methods_spec.rb
|
414
490
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/arguments_consumer_spec.rb
|
415
491
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb
|
416
492
|
- vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/common_concern_spec.rb
|
@@ -467,10 +543,10 @@ files:
|
|
467
543
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb
|
468
544
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos.rb
|
469
545
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb
|
470
|
-
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/
|
471
|
-
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/info.rb
|
546
|
+
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/convert_job.rb
|
472
547
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/quality.rb
|
473
548
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/resolution.rb
|
549
|
+
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/stream.rb
|
474
550
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils.rb
|
475
551
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/instance.rb
|
476
552
|
- vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos.rb
|