ehbrs-tools 0.13.1 → 0.16.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (133) hide show
  1. checksums.yaml +4 -4
  2. data/lib/ehbrs/executables.rb +1 -1
  3. data/lib/ehbrs/runner.rb +4 -7
  4. data/lib/ehbrs/runner/finances.rb +4 -7
  5. data/lib/ehbrs/runner/finances/bb_browser.rb +5 -10
  6. data/lib/ehbrs/runner/fs.rb +4 -7
  7. data/lib/ehbrs/runner/fs/used_space.rb +4 -5
  8. data/lib/ehbrs/runner/google.rb +4 -7
  9. data/lib/ehbrs/runner/google/translate.rb +7 -12
  10. data/lib/ehbrs/runner/self.rb +4 -7
  11. data/lib/ehbrs/runner/self/test.rb +5 -10
  12. data/lib/ehbrs/runner/vg.rb +4 -7
  13. data/lib/ehbrs/runner/vg/ips.rb +9 -14
  14. data/lib/ehbrs/runner/vg/wii.rb +10 -13
  15. data/lib/ehbrs/runner/videos.rb +7 -14
  16. data/lib/ehbrs/runner/videos/extract.rb +10 -13
  17. data/lib/ehbrs/runner/videos/probe.rb +32 -0
  18. data/lib/ehbrs/runner/videos/series.rb +5 -8
  19. data/lib/ehbrs/runner/videos/series/rename.rb +9 -12
  20. data/lib/ehbrs/runner/videos/unsupported.rb +9 -13
  21. data/lib/ehbrs/runner/web_utils.rb +24 -0
  22. data/lib/ehbrs/runner/web_utils/videos.rb +18 -0
  23. data/lib/ehbrs/runner/web_utils/videos/download.rb +63 -0
  24. data/lib/ehbrs/runner/web_utils/videos/upload.rb +75 -0
  25. data/lib/ehbrs/tools/version.rb +1 -1
  26. data/lib/ehbrs/vg/wii/wit/parsers/dump.rb +10 -5
  27. data/lib/ehbrs/videos/file.rb +2 -1
  28. data/lib/ehbrs/videos/series/rename/file/options.rb +3 -13
  29. data/lib/ehbrs/videos/unsupported/fix_profile.rb +1 -0
  30. data/vendor/aranha-parsers/Gemfile +5 -0
  31. data/vendor/aranha-parsers/aranha-parsers.gemspec +23 -0
  32. data/vendor/aranha-parsers/lib/aranha/parsers.rb +9 -0
  33. data/vendor/aranha-parsers/lib/aranha/parsers/base.rb +79 -0
  34. data/vendor/aranha-parsers/lib/aranha/parsers/html.rb +11 -0
  35. data/vendor/aranha-parsers/lib/aranha/parsers/html/base.rb +47 -0
  36. data/vendor/aranha-parsers/lib/aranha/parsers/html/item.rb +24 -0
  37. data/vendor/aranha-parsers/lib/aranha/parsers/html/item_list.rb +29 -0
  38. data/vendor/aranha-parsers/lib/aranha/parsers/html/node.rb +13 -0
  39. data/vendor/aranha-parsers/lib/aranha/parsers/html/node/base.rb +36 -0
  40. data/vendor/aranha-parsers/lib/aranha/parsers/html/node/default.rb +126 -0
  41. data/vendor/aranha-parsers/lib/aranha/parsers/invalid_state_exception.rb +8 -0
  42. data/vendor/aranha-parsers/lib/aranha/parsers/patches.rb +11 -0
  43. data/vendor/aranha-parsers/lib/aranha/parsers/patches/ofx_parser.rb +38 -0
  44. data/vendor/aranha-parsers/lib/aranha/parsers/source_address.rb +55 -0
  45. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/file.rb +31 -0
  46. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/hash_http_get.rb +25 -0
  47. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/hash_http_post.rb +45 -0
  48. data/vendor/aranha-parsers/lib/aranha/parsers/source_address/http_get.rb +49 -0
  49. data/vendor/aranha-parsers/lib/aranha/parsers/source_target_fixtures.rb +77 -0
  50. data/vendor/aranha-parsers/lib/aranha/parsers/spec/source_target_fixtures_example.rb +70 -0
  51. data/vendor/aranha-parsers/lib/aranha/parsers/version.rb +7 -0
  52. data/vendor/aranha-parsers/spec/lib/aranha/parsers/source_address/http_get_spec.rb +21 -0
  53. data/vendor/aranha-parsers/spec/lib/aranha/parsers/source_address_spec.rb +74 -0
  54. data/vendor/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec.rb +27 -0
  55. data/vendor/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub1.source.txt +1 -0
  56. data/vendor/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub1.target.html +1 -0
  57. data/vendor/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub2.source.html +1 -0
  58. data/vendor/aranha-parsers/spec/lib/aranha/parsers/source_target_fixtures_spec_files/stub3.target.yaml +1 -0
  59. data/vendor/aranha-parsers/spec/lib/rubocop_check_spec.rb +7 -0
  60. data/vendor/aranha-parsers/spec/spec_helper.rb +8 -0
  61. data/vendor/eac_cli/eac_cli.gemspec +1 -1
  62. data/vendor/eac_cli/lib/eac_cli/core_ext.rb +4 -0
  63. data/vendor/eac_cli/lib/eac_cli/default_runner.rb +6 -14
  64. data/vendor/eac_cli/lib/eac_cli/definition.rb +35 -3
  65. data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +17 -1
  66. data/vendor/eac_cli/lib/eac_cli/definition/help_formatter.rb +76 -0
  67. data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +21 -4
  68. data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +4 -9
  69. data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +4 -0
  70. data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +27 -64
  71. data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +17 -0
  72. data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +47 -19
  73. data/vendor/eac_cli/lib/eac_cli/patches.rb +4 -0
  74. data/vendor/eac_cli/lib/eac_cli/patches/object.rb +5 -0
  75. data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +25 -0
  76. data/vendor/eac_cli/lib/eac_cli/runner.rb +51 -10
  77. data/vendor/eac_cli/lib/eac_cli/runner/context.rb +20 -3
  78. data/vendor/eac_cli/lib/eac_cli/runner_with.rb +9 -0
  79. data/vendor/eac_cli/lib/eac_cli/runner_with/help.rb +19 -0
  80. data/vendor/eac_cli/lib/eac_cli/runner_with/output_file.rb +26 -0
  81. data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +96 -0
  82. data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
  83. data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +25 -0
  84. data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +48 -40
  85. data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +57 -0
  86. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb +19 -0
  87. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/common_concern.rb +4 -4
  88. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb +43 -0
  89. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +12 -31
  90. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +7 -104
  91. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/entry_reader.rb +81 -0
  92. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/password_entry_reader.rb +18 -0
  93. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +46 -0
  94. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/store_passwords_entry_reader.rb +27 -0
  95. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
  96. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/listable/value.rb +3 -2
  97. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb +4 -0
  98. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb +9 -0
  99. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb +14 -0
  100. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/object/debug.rb +17 -0
  101. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +21 -58
  102. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb +8 -0
  103. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb +67 -0
  104. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb +39 -0
  105. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +2 -1
  106. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/simple_cache.rb +6 -2
  107. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +10 -0
  108. data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
  109. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb +16 -0
  110. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +15 -0
  111. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb +26 -0
  112. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb +32 -0
  113. data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +52 -13
  114. data/vendor/ehbrs_ruby_utils/Gemfile +16 -0
  115. data/vendor/ehbrs_ruby_utils/ehbrs_ruby_utils.gemspec +20 -0
  116. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils.rb +7 -0
  117. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/executables.rb +28 -0
  118. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/version.rb +5 -0
  119. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos.rb +9 -0
  120. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container.rb +11 -0
  121. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/file.rb +31 -0
  122. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/container/info.rb +21 -0
  123. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/quality.rb +68 -0
  124. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/videos/resolution.rb +68 -0
  125. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils.rb +9 -0
  126. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/instance.rb +32 -0
  127. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos.rb +11 -0
  128. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/file.rb +40 -0
  129. data/vendor/ehbrs_ruby_utils/lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb +76 -0
  130. data/vendor/ehbrs_ruby_utils/spec/lib/ehbrs_ruby_utils/videos/resolution_spec.rb +18 -0
  131. data/vendor/ehbrs_ruby_utils/spec/rubocop_check_spec.rb +7 -0
  132. data/vendor/ehbrs_ruby_utils/spec/spec_helper.rb +100 -0
  133. metadata +85 -2
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'ehbrs_ruby_utils/videos/container/file'
5
+ require 'eac_ruby_utils/yaml'
6
+
7
+ module Ehbrs
8
+ class Runner
9
+ class Videos
10
+ class Probe
11
+ runner_with :help, :output_file do
12
+ desc 'FFProbe em um arquivo de vídeo.'
13
+ pos_arg :file_path
14
+ end
15
+
16
+ def run
17
+ run_output
18
+ end
19
+
20
+ def output_content
21
+ ::EacRubyUtils::Yaml.dump(container_file.info.to_h)
22
+ end
23
+
24
+ private
25
+
26
+ def container_file_uncached
27
+ ::EhbrsRubyUtils::Videos::Container::File.new(parsed.file_path)
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,17 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'eac_cli/core_ext'
6
4
 
7
5
  module Ehbrs
8
- class Runner < ::EacRubyUtils::Console::DocoptRunner
9
- class Videos < ::EacRubyUtils::Console::DocoptRunner
10
- class Series < ::EacRubyUtils::Console::DocoptRunner
11
- include ::EacCli::DefaultRunner
6
+ class Runner
7
+ class Videos
8
+ class Series
12
9
  require_sub __FILE__
13
10
 
14
- runner_definition do
11
+ runner_with :help, :subcommands do
15
12
  desc 'Ferramentas para seriados.'
16
13
  subcommands
17
14
  end
@@ -1,21 +1,18 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'eac_cli/core_ext'
6
4
  require 'ehbrs/videos/series/rename/file'
7
5
  require 'ehbrs/videos/series/rename/file/options'
8
6
  require 'ehbrs/videos/series/rename/results_builder'
9
7
 
10
8
  module Ehbrs
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class Videos < ::EacRubyUtils::Console::DocoptRunner
13
- class Series < ::EacRubyUtils::Console::DocoptRunner
14
- class Rename < ::EacRubyUtils::Console::DocoptRunner
15
- include ::EacCli::DefaultRunner
9
+ class Runner
10
+ class Videos
11
+ class Series
12
+ class Rename
16
13
  include ::EacRubyUtils::Fs::Traversable
17
14
 
18
- runner_definition do
15
+ runner_with :help do
19
16
  desc 'Renomeia arquivos de séries.'
20
17
  bool_opt '-r', '--recursive', 'Recursivo.'
21
18
  bool_opt '-c', '--confirm', 'Confirmação a renomeação.'
@@ -43,11 +40,11 @@ module Ehbrs
43
40
  end
44
41
 
45
42
  def paths
46
- options.fetch('<paths>').if_present(['.'])
43
+ parsed.paths.if_present(['.'])
47
44
  end
48
45
 
49
46
  def traverser_recursive
50
- options.fetch('--recursive')
47
+ parsed.recursive
51
48
  end
52
49
 
53
50
  def traverser_check_file(path)
@@ -55,7 +52,7 @@ module Ehbrs
55
52
  end
56
53
 
57
54
  def series_file_options_uncached
58
- ::Ehbrs::Videos::Series::Rename::File::Options.new(options)
55
+ ::Ehbrs::Videos::Series::Rename::File::Options.new(parsed)
59
56
  end
60
57
 
61
58
  def show_results
@@ -1,21 +1,17 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'eac_cli/default_runner'
4
- require 'eac_ruby_utils/core_ext'
5
- require 'eac_ruby_utils/console/docopt_runner'
3
+ require 'eac_cli/core_ext'
6
4
  require 'ehbrs/videos/unsupported/check_set'
7
5
  require 'ehbrs/videos/unsupported/search'
8
6
  require 'ehbrs/videos/unsupported/profiles'
9
7
 
10
8
  module Ehbrs
11
- class Runner < ::EacRubyUtils::Console::DocoptRunner
12
- class Videos < ::EacRubyUtils::Console::DocoptRunner
13
- class Unsupported < ::EacRubyUtils::Console::DocoptRunner
14
- include ::EacCli::DefaultRunner
15
-
9
+ class Runner
10
+ class Videos
11
+ class Unsupported
16
12
  PROFILES = %w[philco samsung].freeze
17
13
 
18
- runner_definition do
14
+ runner_with :help do
19
15
  desc 'Procura e converte vídeos não suportados pelas TVs de EHB/RS.'
20
16
  bool_opt '-f', '--fix', 'Converte vídeos para o formato apropriado.'
21
17
  arg_opt '-p', '--profiles', "Seleciona os perfis (#{PROFILES.join(', ')})."
@@ -41,17 +37,17 @@ module Ehbrs
41
37
  end
42
38
 
43
39
  def paths
44
- options.fetch('<paths>')
40
+ parsed.paths
45
41
  end
46
42
 
47
43
  def file_options
48
44
  { file_check_set: file_check_set, track_check_set: track_check_set,
49
- fix: options.fetch('--fix') }
45
+ fix: parsed.fix? }
50
46
  end
51
47
 
52
48
  def profiles_uncached
53
- options.fetch('--profiles').if_present(PROFILES) { |v| v.split(',').map(&:strip) }
54
- .map { |name| profile_class(name).instance }
49
+ parsed.profiles.if_present(PROFILES) { |v| v.split(',').map(&:strip) }
50
+ .map { |name| profile_class(name).instance }
55
51
  end
56
52
 
57
53
  def profile_class(profile_name)
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'ehbrs_ruby_utils/web_utils/instance'
5
+
6
+ module Ehbrs
7
+ class Runner
8
+ class WebUtils
9
+ require_sub __FILE__
10
+
11
+ runner_with :help, :subcommands do
12
+ desc 'Ferramentas para EHB/RS Utils.'
13
+ pos_arg :instance_id
14
+ subcommands
15
+ end
16
+
17
+ private
18
+
19
+ def instance_uncached
20
+ ::EhbrsRubyUtils::WebUtils::Instance.by_id(parsed.instance_id)
21
+ end
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+
5
+ module Ehbrs
6
+ class Runner
7
+ class WebUtils
8
+ class Videos
9
+ require_sub __FILE__
10
+
11
+ runner_with :help, :subcommands do
12
+ desc 'Ferramentas de vídeos para EHB/RS Utils.'
13
+ subcommands
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'ehbrs_ruby_utils/web_utils/videos/file'
5
+
6
+ module Ehbrs
7
+ class Runner
8
+ class WebUtils
9
+ class Videos
10
+ class Download
11
+ runner_with :help do
12
+ desc 'Importa informações de arquivos de vídeo de uma instância EHB/RS Utils.'
13
+ bool_opt '-c', '--confirm', 'Confirma as mudanças'
14
+ end
15
+
16
+ def run
17
+ start_banner
18
+ to_rename.each { |file| process_rename_file(file) }
19
+ to_delete.each { |file| process_delete_file(file) }
20
+ end
21
+
22
+ private
23
+
24
+ def start_banner
25
+ infov 'Files downloaded', files.count
26
+ infov 'To rename', to_rename.count
27
+ infov 'To delete', to_delete.count
28
+ end
29
+
30
+ def process_rename_file(file)
31
+ infov " * #{file.new_path}", file.original_path
32
+ file.rename if parsed.confirm?
33
+ end
34
+
35
+ def process_delete_file(file)
36
+ infov " * #{file.new_path}", 'REMOVE'
37
+ file.remove if parsed.confirm?
38
+ end
39
+
40
+ def files_uncached
41
+ data.map { |file_data| ::EhbrsRubyUtils::WebUtils::Videos::File.new(file_data) }
42
+ end
43
+
44
+ def to_rename_uncached
45
+ files.select(&:path_changed?)
46
+ end
47
+
48
+ def to_delete_uncached
49
+ files.reject { |f| f.type == 'Videos::SeriesDirectory' }.select(&:unwanted)
50
+ end
51
+
52
+ def data_uncached
53
+ ::JSON.parse(raw_content)
54
+ end
55
+
56
+ def raw_content
57
+ runner_context.call(:instance).http_request('/videos/files/export').body
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_cli/core_ext'
4
+ require 'ehbrs_ruby_utils/web_utils/videos/files_list'
5
+ require 'json'
6
+ require 'yaml'
7
+
8
+ module Ehbrs
9
+ class Runner
10
+ class WebUtils
11
+ class Videos
12
+ class Upload
13
+ runner_with :help do
14
+ desc 'Exporta informações de arquivos de vídeo para uma instância EHB/RS Utils.'
15
+ bool_opt '-P', '--no-ffprobe', 'Não recupera dados com "ffprobe".'
16
+ end
17
+
18
+ def run
19
+ %w[movies series].each { |type| upload_files_list(type) }
20
+ end
21
+
22
+ def upload_files_list(type)
23
+ infom "Uploading \"#{type}\" files list..."
24
+ files_list_path = send("#{type}_files_list")
25
+ infov 'Path', files_list_path
26
+ process_response(upload_request(files_list_path))
27
+ end
28
+
29
+ def upload_request(files_list_path)
30
+ runner_context.call(:instance).http_request(
31
+ '/videos/files/import',
32
+ method: :put,
33
+ body: {
34
+ 'videos_tableless_local_import_list[list_file]' => ::File.new(files_list_path)
35
+ },
36
+ header: {
37
+ 'Accept' => 'application/json'
38
+ }
39
+ )
40
+ end
41
+
42
+ def process_response(response)
43
+ infov 'Response status', response.status
44
+ if response.status == 200
45
+ pp ::JSON.parse(response.body) # rubocop:disable Rails/Output
46
+ else
47
+ error_file = '/tmp/ehbrsutils.html'
48
+ ::File.write(error_file, response.body)
49
+ system('firefox', error_file)
50
+ fatal_error('Retornou com status de erro: ' + error_file)
51
+ end
52
+ end
53
+
54
+ def series_files_list_uncached
55
+ write_files_list('Videos::SeriesDirectory', :series_directory)
56
+ end
57
+
58
+ def movies_files_list_uncached
59
+ write_files_list('Videos::MovieFile', :movies_directory)
60
+ end
61
+
62
+ def write_files_list(file_class, read_entry)
63
+ files_list = ::EhbrsRubyUtils::WebUtils::Videos::FilesList.new(
64
+ file_class,
65
+ runner_context.call(:instance).read_entry(read_entry),
66
+ ffprobe: !parsed.no_ffprobe?
67
+ )
68
+ infov 'Files found', files_list.data.fetch(:files).count
69
+ files_list.write_to
70
+ end
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.13.1'
5
+ VERSION = '0.16.1'
6
6
  end
7
7
  end
@@ -11,7 +11,11 @@ module Ehbrs
11
11
  enable_simple_cache
12
12
  common_constructor :output
13
13
 
14
- FILE_DISC_TYPE_PATTERN = %r{\A(\S+)/(\S+)\s+&\s+(\S+)\z}.freeze
14
+ # WIA/WII (v1.00,LZMA2.7@100) & Wii
15
+ # ISO/WII & Wii
16
+ # WBFS/WII & Wii
17
+ # ISO/GC & GameCube
18
+ FILE_DISC_TYPE_PATTERN = %r{\A(\S+)/(\S+)\s+(?:\(([^\)]+)\)\s+)?&\s+(\S+)\z}.freeze
15
19
 
16
20
  private
17
21
 
@@ -42,10 +46,11 @@ module Ehbrs
42
46
  end
43
47
 
44
48
  def parse_file_disc_type(value)
45
- FILE_DISC_TYPE_PATTERN
46
- .match(value)
47
- .if_present { |m| { type: m[1], platform_acronym: m[2], platform_name: m[3] } }
48
- .if_blank { raise "\"#{FILE_DISC_TYPE_PATTERN}\" does not match \"#{value}\"" }
49
+ r = FILE_DISC_TYPE_PATTERN.match(value).if_present do |m|
50
+ { type: m[1], platform_acronym: m[2], type_extra: m[3],
51
+ platform_name: m[4] }
52
+ end
53
+ r.if_blank { raise "\"#{FILE_DISC_TYPE_PATTERN}\" does not match \"#{value}\"" }
49
54
  end
50
55
 
51
56
  def parse_disc_part_ids(value)
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'eac_ruby_utils/core_ext'
4
4
  require 'ehbrs/videos/track'
5
+ require 'ehbrs_ruby_utils/executables'
5
6
 
6
7
  module Ehbrs
7
8
  module Videos
@@ -52,7 +53,7 @@ module Ehbrs
52
53
  end
53
54
 
54
55
  def content_uncached
55
- EacRubyUtils::Envs.local.command('ffprobe', path).execute!(output: :stderr).scrub
56
+ ::EhbrsRubyUtils::Executables.ffprobe.command(path).execute!(output: :stderr).scrub
56
57
  end
57
58
 
58
59
  def duration_uncached
@@ -6,21 +6,11 @@ module Ehbrs
6
6
  module Rename
7
7
  class File
8
8
  class Options
9
- def initialize(docopt_runner_options)
10
- @options = docopt_runner_options
11
- end
12
-
13
- %w[kernel confirm recursive extension].each do |method|
14
- class_eval <<-RUBY_EVAL, __FILE__, __LINE__ + 1
15
- def #{method}
16
- @options.fetch('--#{method}')
17
- end
18
- RUBY_EVAL
19
- end
9
+ common_constructor :options
10
+ delegate :kernel, :confirm, :recursive, :extension, to: :options
20
11
 
21
12
  def episode_increment
22
- r = @options.fetch('--episode-increment')
23
- r.present? ? r.to_i : 0
13
+ options.episode_increment.if_present(0, &:to_i)
24
14
  end
25
15
  end
26
16
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ehbrs/videos/profiles/same_quality'
4
+ require 'ehbrs/videos/unsupported/fixes/supported_container'
4
5
 
5
6
  module Ehbrs
6
7
  module Videos
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ $LOAD_PATH.push File.expand_path('lib', __dir__)
4
+
5
+ require 'aranha/parsers/version'
6
+
7
+ Gem::Specification.new do |s|
8
+ s.name = 'aranha-parsers'
9
+ s.version = ::Aranha::Parsers::VERSION
10
+ s.authors = ['Esquilo Azul Company']
11
+ s.summary = 'Parsers\' utilities for Ruby.'
12
+
13
+ s.files = Dir['{lib}/**/*', 'Gemfile']
14
+
15
+ s.add_dependency 'activesupport', '>= 4.0.0'
16
+ s.add_dependency 'addressable', '~> 2.7'
17
+ s.add_dependency 'curb', '~> 0.9.10'
18
+ s.add_dependency 'eac_ruby_utils', '~> 0.33', '>= 0.33.1'
19
+ s.add_dependency 'httpclient', '~> 2.8', '>= 2.8.3'
20
+ s.add_dependency 'ofx-parser', '~> 1.1.0'
21
+
22
+ s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1'
23
+ end