ehbrs-tools 0.12.0 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (121) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs/executables.rb +1 -1
  3. data/lib/ehbrs/runner.rb +9 -13
  4. data/lib/ehbrs/runner/finances.rb +19 -0
  5. data/lib/ehbrs/runner/finances/bb_browser.rb +40 -0
  6. data/lib/ehbrs/runner/fs/used_space.rb +4 -4
  7. data/lib/ehbrs/runner/videos.rb +6 -11
  8. data/lib/ehbrs/runner/videos/probe.rb +35 -0
  9. data/lib/ehbrs/runner/web_utils.rb +26 -0
  10. data/lib/ehbrs/runner/web_utils/videos.rb +20 -0
  11. data/lib/ehbrs/runner/web_utils/videos/download.rb +66 -0
  12. data/lib/ehbrs/runner/web_utils/videos/upload.rb +78 -0
  13. data/lib/ehbrs/tools/version.rb +1 -1
  14. data/lib/ehbrs/videos/file.rb +2 -1
  15. data/lib/ehbrs/videos/unsupported/fix_profile.rb +1 -0
  16. data/vendor/eac_cli/eac_cli.gemspec +3 -3
  17. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +4 -0
  18. data/vendor/eac_cli/lib/eac_cli/default_runner.rb +6 -14
  19. data/vendor/eac_cli/lib/eac_cli/definition.rb +72 -0
  20. data/vendor/eac_cli/lib/eac_cli/definition/argument_option.rb +13 -0
  21. data/vendor/eac_cli/lib/eac_cli/{runner → definition}/base_option.rb +5 -1
  22. data/vendor/eac_cli/lib/eac_cli/definition/boolean_option.rb +13 -0
  23. data/vendor/eac_cli/lib/eac_cli/{runner → definition}/positional_argument.rb +5 -1
  24. data/vendor/eac_cli/lib/eac_cli/{runner/docopt_doc.rb → docopt/doc_builder.rb} +15 -8
  25. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +45 -0
  26. data/vendor/eac_cli/lib/eac_cli/parser.rb +14 -0
  27. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +56 -0
  28. data/vendor/eac_cli/lib/eac_cli/parser/error.rb +15 -0
  29. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +105 -0
  30. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +21 -0
  31. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +49 -0
  32. data/vendor/eac_cli/lib/eac_cli/patches.rb +4 -0
  33. data/vendor/eac_cli/lib/eac_cli/patches/object.rb +5 -0
  34. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +24 -0
  35. data/vendor/eac_cli/lib/eac_cli/runner.rb +64 -7
  36. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +18 -0
  37. data/vendor/eac_cli/lib/eac_cli/runner_with.rb +9 -0
  38. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +19 -0
  39. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +26 -0
  40. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  41. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +70 -0
  42. data/vendor/eac_docker/Gemfile +5 -0
  43. data/vendor/eac_docker/eac_docker.gemspec +18 -0
  44. data/vendor/eac_docker/lib/eac_docker.rb +7 -0
  45. data/vendor/eac_docker/lib/eac_docker/container.rb +50 -0
  46. data/vendor/eac_docker/lib/eac_docker/executables.rb +18 -0
  47. data/vendor/eac_docker/lib/eac_docker/images.rb +9 -0
  48. data/vendor/eac_docker/lib/eac_docker/images/base.rb +14 -0
  49. data/vendor/eac_docker/lib/eac_docker/images/named.rb +30 -0
  50. data/vendor/eac_docker/lib/eac_docker/rspec.rb +17 -0
  51. data/vendor/eac_docker/lib/eac_docker/version.rb +5 -0
  52. data/vendor/eac_docker/spec/lib/eac_docker/executables_spec.rb +9 -0
  53. data/vendor/eac_docker/spec/rubocop_spec.rb +7 -0
  54. data/vendor/eac_docker/spec/spec_helper.rb +103 -0
  55. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/boolean.rb +31 -0
  56. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +4 -4
  57. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner.rb +6 -0
  58. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_class_methods.rb +2 -2
  59. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/docopt_runner/_subcommands.rb +8 -2
  60. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command.rb +1 -0
  61. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/command/extra_options.rb +8 -0
  62. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env.rb +12 -9
  63. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/dasho_options.rb +53 -0
  64. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/identity_file.rb +25 -0
  65. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/quiet.rb +24 -0
  66. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/envs/ssh_env/terminal.rb +34 -0
  67. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs_cache.rb +1 -0
  68. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable.rb +15 -0
  69. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/array_accessor.rb +32 -0
  70. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/base_accessor.rb +23 -0
  71. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/boolean_accessor.rb +16 -0
  72. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/class_methods.rb +20 -0
  73. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/common_accessor.rb +30 -0
  74. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/hash_accessor.rb +46 -0
  75. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/immutable/instance_methods.rb +21 -0
  76. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/inflector.rb +18 -0
  77. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/list.rb +5 -0
  78. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +3 -2
  79. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/module/immutable.rb +10 -0
  80. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/if_respond.rb +22 -0
  81. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string.rb +4 -0
  82. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/string/inflector.rb +9 -0
  83. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/require_sub.rb +38 -11
  84. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +6 -2
  85. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +53 -0
  86. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/directory.rb +7 -1
  87. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/file.rb +8 -59
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_not_found_error.rb +7 -0
  89. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers.rb +25 -0
  90. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/base.rb +23 -0
  91. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/entries_reader.rb +25 -0
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/generic.rb +25 -0
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/templates/variable_providers/hash.rb +29 -0
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  95. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/inflector_spec.rb +15 -0
  96. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/ruby_spec.rb +22 -0
  97. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/struct_spec.rb +46 -0
  98. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/templates/file_spec.rb +1 -0
  99. data/vendor/ehbrs_ruby_utils/Gemfile +16 -0
  100. data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +20 -0
  101. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils.rb +7 -0
  102. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/executables.rb +28 -0
  103. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +5 -0
  104. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos.rb +9 -0
  105. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +11 -0
  106. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/file.rb +31 -0
  107. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/info.rb +21 -0
  108. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/quality.rb +68 -0
  109. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/resolution.rb +68 -0
  110. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils.rb +9 -0
  111. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/instance.rb +32 -0
  112. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos.rb +11 -0
  113. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/file.rb +40 -0
  114. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb +76 -0
  115. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/resolution_spec.rb +18 -0
  116. data/vendor/ehbrs_ruby_utils/spec/rubocop_check_spec.rb +7 -0
  117. data/vendor/ehbrs_ruby_utils/spec/spec_helper.rb +100 -0
  118. metadata +92 -10
  119. data/vendor/eac_cli/lib/eac_cli/runner/argument_option.rb +0 -13
  120. data/vendor/eac_cli/lib/eac_cli/runner/boolean_option.rb +0 -13
  121. data/vendor/eac_cli/lib/eac_cli/runner/definition.rb +0 -64
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ # Maintain your gem's version:
6
+ require 'ehbrs_ruby_utils/version'
7
+
8
+ # Describe your gem and declare its dependencies:
9
+ Gem::Specification.new do |s|
10
+ s.name = 'ehbrs_ruby_utils'
11
+ s.version = ::EhbrsRubyUtils::VERSION
12
+ s.authors = ['Eduardo H. Bogoni']
13
+ s.summary = 'Utilities for EHB/RS\'s Ruby projects.'
14
+
15
+ s.files = Dir['{lib}/**/*']
16
+
17
+ s.add_dependency 'eac_ruby_utils', '~> 0.36'
18
+
19
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.1'
20
+ end
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ require_sub __FILE__
7
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/envs'
4
+ require 'eac_ruby_utils/core_ext'
5
+
6
+ module EhbrsRubyUtils
7
+ module Executables
8
+ class << self
9
+ enable_simple_cache
10
+
11
+ def env
12
+ ::EacRubyUtils::Envs.local
13
+ end
14
+
15
+ private
16
+
17
+ {
18
+ '-version' => %w[ffprobe]
19
+ }.each do |validate_arg, commands|
20
+ commands.each do |command|
21
+ define_method("#{command}_uncached") do
22
+ env.executable(command, validate_arg)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EhbrsRubyUtils
4
+ VERSION = '0.3.0'
5
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos
7
+ module Container
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'json'
4
+ require 'eac_ruby_utils/core_ext'
5
+ require 'ehbrs_ruby_utils/executables'
6
+ require 'ehbrs_ruby_utils/videos/container/info'
7
+
8
+ module EhbrsRubyUtils
9
+ module Videos
10
+ module Container
11
+ class File
12
+ enable_simple_cache
13
+ common_constructor :path do
14
+ self.path = path.to_pathname
15
+ end
16
+
17
+ private
18
+
19
+ def info_uncached
20
+ ::EhbrsRubyUtils::Videos::Container::Info.new(
21
+ ::JSON.parse(
22
+ ::EhbrsRubyUtils::Executables.ffprobe.command(
23
+ '-hide_banner', '-print_format', 'json', '-show_format', '-show_streams', path
24
+ ).execute!
25
+ )
26
+ )
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/videos/container/info'
5
+
6
+ module EhbrsRubyUtils
7
+ module Videos
8
+ module Container
9
+ class Info
10
+ enable_simple_cache
11
+ common_constructor :ffprobe_data do
12
+ self.ffprobe_data = ffprobe_data.with_indifferent_access.freeze
13
+ end
14
+
15
+ def to_h
16
+ ffprobe_data
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module Videos
7
+ class Quality
8
+ enable_simple_cache
9
+ include ::Comparable
10
+
11
+ POSITIVE_MARGIN = 0.75
12
+ LIST = [240, 480, 720, 1080, 2160].freeze
13
+
14
+ class << self
15
+ enable_simple_cache
16
+
17
+ def by_height(height)
18
+ list.find { |v| v.height == height }
19
+ end
20
+
21
+ private
22
+
23
+ def list_uncached
24
+ preceding = nil
25
+ LIST.map { |height| preceding = new(height, preceding) }
26
+ end
27
+ end
28
+
29
+ attr_reader :following
30
+
31
+ common_constructor :height, :preceding do
32
+ preceding&.send('following=', self)
33
+ end
34
+
35
+ def <=>(other)
36
+ height <=> other.height
37
+ end
38
+
39
+ def to_s
40
+ height.to_s
41
+ end
42
+
43
+ def to_xs
44
+ "#{height} (Min: #{min_height}, Max: #{max_height})"
45
+ end
46
+
47
+ def resolution_match?(resolution)
48
+ (min_height.blank? || resolution.lower >= min_height) &&
49
+ (max_height.blank? || resolution.lower <= max_height)
50
+ end
51
+
52
+ private
53
+
54
+ attr_writer :following
55
+
56
+ def max_height_uncached
57
+ following.if_present do |v|
58
+ delta = v.height - height
59
+ height + (delta * POSITIVE_MARGIN).to_i
60
+ end
61
+ end
62
+
63
+ def min_height_uncached
64
+ preceding.if_present { |v| v.max_height + 1 }
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,68 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'ehbrs_ruby_utils/videos/quality'
5
+
6
+ module EhbrsRubyUtils
7
+ module Videos
8
+ class Resolution
9
+ enable_simple_cache
10
+ include ::Comparable
11
+
12
+ class << self
13
+ def valid_dimension?(dimension)
14
+ dimension.is_a?(::Integer) && dimension.positive?
15
+ end
16
+ end
17
+
18
+ common_constructor :width, :height
19
+
20
+ def <=>(other)
21
+ r = (lower <=> other.lower)
22
+ return r unless r.zero?
23
+
24
+ higher <=> other.higher
25
+ end
26
+
27
+ def to_xs
28
+ [quality_to_s, resolution_to_s].join(' / ')
29
+ end
30
+
31
+ def higher
32
+ width > height ? width : height
33
+ end
34
+
35
+ def lower
36
+ width < height ? width : height
37
+ end
38
+
39
+ def pixels
40
+ width * height
41
+ end
42
+
43
+ def quality_to_s
44
+ quality.if_present('?', &:to_s)
45
+ end
46
+
47
+ def resolution_to_s
48
+ "#{width}x#{height}"
49
+ end
50
+
51
+ def to_s
52
+ resolution_to_s
53
+ end
54
+
55
+ def valid?
56
+ [width, height].all? { |d| self.class.valid_dimension?(d) }
57
+ end
58
+
59
+ private
60
+
61
+ def quality_uncached
62
+ ::EhbrsRubyUtils::Videos::Quality.list
63
+ .find { |quality| quality.resolution_match?(self) } ||
64
+ raise("No quality matches resolution #{resolution}")
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module WebUtils
7
+ require_sub __FILE__
8
+ end
9
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'avm/instances/base'
5
+ require 'httpclient'
6
+
7
+ module EhbrsRubyUtils
8
+ module WebUtils
9
+ class Instance < ::Avm::Instances::Base
10
+ def root_url
11
+ read_entry(:url)
12
+ end
13
+
14
+ def resource_url(resource_url_suffix)
15
+ root_url + '/' + resource_url_suffix.gsub(%r{\A/+}, '')
16
+ end
17
+
18
+ def http_request(resource_url_suffix, options = {})
19
+ method = options.delete(:method) || 'get'
20
+ url = resource_url(resource_url_suffix)
21
+ http_client.request(method, url, options)
22
+ end
23
+
24
+ def http_client_uncached
25
+ client = HTTPClient.new
26
+ client.force_basic_auth = true
27
+ client.set_basic_auth(root_url, read_entry(:admin_username), read_entry(:admin_password))
28
+ client
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+
5
+ module EhbrsRubyUtils
6
+ module WebUtils
7
+ module Videos
8
+ require_sub __FILE__
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'ostruct'
4
+
5
+ module EhbrsRubyUtils
6
+ module WebUtils
7
+ module Videos
8
+ class File < ::SimpleDelegator
9
+ def initialize(data)
10
+ super(::OpenStruct.new(data))
11
+ end
12
+
13
+ def exist?
14
+ ::File.exist?(original_path)
15
+ end
16
+
17
+ def path_changed?
18
+ original_path != new_path
19
+ end
20
+
21
+ def can_rename?
22
+ ::File.exist?(original_path) && !::File.exist?(new_path)
23
+ end
24
+
25
+ def remove
26
+ return unless exist?
27
+
28
+ ::File.unlink(original_path)
29
+ end
30
+
31
+ def rename
32
+ return unless can_rename?
33
+
34
+ ::FileUtils.mkdir_p(::File.dirname(new_path))
35
+ ::FileUtils.mv(original_path, new_path)
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,76 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/json'
4
+ require 'eac_ruby_utils/fs/temp'
5
+ require 'ehbrs_ruby_utils/executables'
6
+
7
+ module EhbrsRubyUtils
8
+ module WebUtils
9
+ module Videos
10
+ class FilesList
11
+ enable_console_speaker
12
+ enable_simple_cache
13
+
14
+ common_constructor :type_class, :root_path, :options do
15
+ self.root_path = root_path.to_pathname
16
+ raise "\"#{root_path}\" is not a directory" unless root_path.directory?
17
+
18
+ self.options = options.with_indifferent_access.freeze
19
+ end
20
+
21
+ def write_to(path = nil)
22
+ path ||= ::EacRubyUtils::Fs::Temp.file.to_path
23
+ ::File.write(path, data.to_json)
24
+ path
25
+ end
26
+
27
+ def data
28
+ {
29
+ root_path: root_path.to_path,
30
+ type: type_class,
31
+ files: files_data
32
+ }
33
+ end
34
+
35
+ def files_data
36
+ case type_class
37
+ when 'Videos::MovieFile' then movies_files_data
38
+ when 'Videos::SeriesDirectory' then series_files_data
39
+ else raise "Unknown type class: \"#{type_class}\""
40
+ end
41
+ end
42
+
43
+ def movies_files_data
44
+ r = []
45
+ Dir["#{root_path}/**/*"].each do |path|
46
+ r << file_data(path) if ::File.file?(path)
47
+ end
48
+ r
49
+ end
50
+
51
+ def series_files_data
52
+ r = []
53
+ Dir["#{root_path}/*"].each do |path|
54
+ r << file_data(path) if ::File.directory?(path)
55
+ end
56
+ r
57
+ end
58
+
59
+ def file_data(path)
60
+ r = { original_path: path }
61
+ r[:ffprobe_data] = file_ffprobe_data(path) if ::File.file?(path)
62
+ r
63
+ end
64
+
65
+ def file_ffprobe_data(path)
66
+ return {} unless options.fetch(:ffprobe)
67
+
68
+ infom "Probing \"#{path}\"..."
69
+ ::JSON.parse(::EhbrsRubyUtils::Executables.ffprobe.command(
70
+ '-hide_banner', '-print_format', 'json', '-show_format', '-show_streams', path
71
+ ).execute!)
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end