ehbrs-tools 0.15.0 → 0.16.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/runner.rb +4 -7
- data/lib/ehbrs/runner/finances.rb +4 -7
- data/lib/ehbrs/runner/finances/bb_browser.rb +5 -10
- data/lib/ehbrs/runner/fs.rb +4 -7
- data/lib/ehbrs/runner/fs/used_space.rb +4 -5
- data/lib/ehbrs/runner/google.rb +4 -7
- data/lib/ehbrs/runner/google/translate.rb +7 -12
- data/lib/ehbrs/runner/self.rb +4 -7
- data/lib/ehbrs/runner/self/test.rb +5 -10
- data/lib/ehbrs/runner/vg.rb +4 -7
- data/lib/ehbrs/runner/vg/ips.rb +9 -14
- data/lib/ehbrs/runner/vg/wii.rb +10 -13
- data/lib/ehbrs/runner/videos.rb +3 -5
- data/lib/ehbrs/runner/videos/extract.rb +10 -13
- data/lib/ehbrs/runner/videos/probe.rb +3 -6
- data/lib/ehbrs/runner/videos/series.rb +5 -8
- data/lib/ehbrs/runner/videos/series/rename.rb +9 -12
- data/lib/ehbrs/runner/videos/unsupported.rb +9 -13
- data/lib/ehbrs/runner/web_utils.rb +5 -7
- data/lib/ehbrs/runner/web_utils/videos.rb +4 -6
- data/lib/ehbrs/runner/web_utils/videos/download.rb +8 -11
- data/lib/ehbrs/runner/web_utils/videos/upload.rb +8 -11
- data/lib/ehbrs/tools/version.rb +1 -1
- data/lib/ehbrs/videos/series/rename/file/options.rb +3 -13
- data/vendor/eac_cli/eac_cli.gemspec +1 -1
- data/vendor/eac_cli/lib/eac_cli/definition.rb +25 -3
- data/vendor/eac_cli/lib/eac_cli/definition/base_option.rb +17 -1
- data/vendor/eac_cli/lib/eac_cli/definition/positional_argument.rb +8 -4
- data/vendor/eac_cli/lib/eac_cli/docopt/runner_extension.rb +1 -0
- data/vendor/eac_cli/lib/eac_cli/parser/collector.rb +4 -0
- data/vendor/eac_cli/lib/eac_cli/parser/options_collection.rb +23 -1
- data/vendor/eac_cli/lib/eac_cli/parser/parse_result.rb +17 -0
- data/vendor/eac_cli/lib/eac_cli/parser/positional_collection.rb +47 -19
- data/vendor/eac_cli/lib/eac_cli/patches/object/runner_with.rb +2 -1
- data/vendor/eac_cli/lib/eac_cli/runner.rb +5 -1
- data/vendor/eac_cli/lib/eac_cli/runner/context.rb +19 -2
- data/vendor/eac_cli/lib/eac_cli/runner_with/subcommands.rb +96 -0
- data/vendor/eac_cli/lib/eac_cli/version.rb +1 -1
- data/vendor/eac_cli/spec/lib/eac_cli/docopt/runner_extension_spec.rb +25 -0
- data/vendor/eac_cli/spec/lib/eac_cli/runner_spec.rb +48 -40
- data/vendor/eac_cli/spec/lib/eac_cli/runner_with/subcommands_spec.rb +57 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/blank_not_blank.rb +19 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/base.rb +43 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/configs/file.rb +12 -31
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs.rb +8 -40
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/console/configs/read_entry_options.rb +41 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/fs/clearable_directory.rb +57 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/current.rb +9 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/patches/enumerator/stopped.rb +14 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash.rb +21 -58
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/entry_key_error.rb +8 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/node.rb +67 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/paths_hash/path_search.rb +39 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/ruby/command.rb +2 -1
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/struct.rb +4 -0
- data/vendor/eac_ruby_utils/lib/eac_ruby_utils/version.rb +1 -1
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/blank_not_blank_spec.rb +16 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/configs_spec.rb +15 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/current_spec.rb +26 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/patches/enumerator/stopped_spec.rb +32 -0
- data/vendor/eac_ruby_utils/spec/lib/eac_ruby_utils/paths_hash_spec.rb +52 -13
- metadata +18 -2
@@ -1,17 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/core_ext'
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
4
|
require 'ehbrs_ruby_utils/videos/container/file'
|
6
5
|
require 'eac_ruby_utils/yaml'
|
7
6
|
|
8
7
|
module Ehbrs
|
9
|
-
class Runner
|
10
|
-
class Videos
|
8
|
+
class Runner
|
9
|
+
class Videos
|
11
10
|
class Probe
|
12
|
-
runner_with :output_file
|
13
|
-
|
14
|
-
runner_definition do
|
11
|
+
runner_with :help, :output_file do
|
15
12
|
desc 'FFProbe em um arquivo de vídeo.'
|
16
13
|
pos_arg :file_path
|
17
14
|
end
|
@@ -1,17 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require 'eac_cli/
|
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
|
9
|
-
class Videos
|
10
|
-
class Series
|
11
|
-
include ::EacCli::DefaultRunner
|
6
|
+
class Runner
|
7
|
+
class Videos
|
8
|
+
class Series
|
12
9
|
require_sub __FILE__
|
13
10
|
|
14
|
-
|
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/
|
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
|
12
|
-
class Videos
|
13
|
-
class Series
|
14
|
-
class Rename
|
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
|
-
|
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
|
-
|
43
|
+
parsed.paths.if_present(['.'])
|
47
44
|
end
|
48
45
|
|
49
46
|
def traverser_recursive
|
50
|
-
|
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(
|
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/
|
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
|
12
|
-
class Videos
|
13
|
-
class Unsupported
|
14
|
-
include ::EacCli::DefaultRunner
|
15
|
-
|
9
|
+
class Runner
|
10
|
+
class Videos
|
11
|
+
class Unsupported
|
16
12
|
PROFILES = %w[philco samsung].freeze
|
17
13
|
|
18
|
-
|
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
|
-
|
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:
|
45
|
+
fix: parsed.fix? }
|
50
46
|
end
|
51
47
|
|
52
48
|
def profiles_uncached
|
53
|
-
|
54
|
-
|
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)
|
@@ -1,25 +1,23 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/core_ext'
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
4
|
require 'ehbrs_ruby_utils/web_utils/instance'
|
6
5
|
|
7
6
|
module Ehbrs
|
8
|
-
class Runner
|
9
|
-
class WebUtils
|
10
|
-
runner_with
|
7
|
+
class Runner
|
8
|
+
class WebUtils
|
11
9
|
require_sub __FILE__
|
12
10
|
|
13
|
-
|
11
|
+
runner_with :help, :subcommands do
|
14
12
|
desc 'Ferramentas para EHB/RS Utils.'
|
15
|
-
pos_arg :
|
13
|
+
pos_arg :instance_id
|
16
14
|
subcommands
|
17
15
|
end
|
18
16
|
|
19
17
|
private
|
20
18
|
|
21
19
|
def instance_uncached
|
22
|
-
::EhbrsRubyUtils::WebUtils::Instance.by_id(
|
20
|
+
::EhbrsRubyUtils::WebUtils::Instance.by_id(parsed.instance_id)
|
23
21
|
end
|
24
22
|
end
|
25
23
|
end
|
@@ -1,16 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/core_ext'
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
4
|
|
6
5
|
module Ehbrs
|
7
|
-
class Runner
|
8
|
-
class WebUtils
|
9
|
-
class Videos
|
10
|
-
runner_with
|
6
|
+
class Runner
|
7
|
+
class WebUtils
|
8
|
+
class Videos
|
11
9
|
require_sub __FILE__
|
12
10
|
|
13
|
-
|
11
|
+
runner_with :help, :subcommands do
|
14
12
|
desc 'Ferramentas de vídeos para EHB/RS Utils.'
|
15
13
|
subcommands
|
16
14
|
end
|
@@ -2,16 +2,13 @@
|
|
2
2
|
|
3
3
|
require 'eac_cli/core_ext'
|
4
4
|
require 'ehbrs_ruby_utils/web_utils/videos/file'
|
5
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
6
5
|
|
7
6
|
module Ehbrs
|
8
|
-
class Runner
|
9
|
-
class WebUtils
|
10
|
-
class Videos
|
11
|
-
class Download
|
12
|
-
runner_with
|
13
|
-
|
14
|
-
runner_definition do
|
7
|
+
class Runner
|
8
|
+
class WebUtils
|
9
|
+
class Videos
|
10
|
+
class Download
|
11
|
+
runner_with :help do
|
15
12
|
desc 'Importa informações de arquivos de vídeo de uma instância EHB/RS Utils.'
|
16
13
|
bool_opt '-c', '--confirm', 'Confirma as mudanças'
|
17
14
|
end
|
@@ -32,12 +29,12 @@ module Ehbrs
|
|
32
29
|
|
33
30
|
def process_rename_file(file)
|
34
31
|
infov " * #{file.new_path}", file.original_path
|
35
|
-
file.rename if
|
32
|
+
file.rename if parsed.confirm?
|
36
33
|
end
|
37
34
|
|
38
35
|
def process_delete_file(file)
|
39
36
|
infov " * #{file.new_path}", 'REMOVE'
|
40
|
-
file.remove if
|
37
|
+
file.remove if parsed.confirm?
|
41
38
|
end
|
42
39
|
|
43
40
|
def files_uncached
|
@@ -57,7 +54,7 @@ module Ehbrs
|
|
57
54
|
end
|
58
55
|
|
59
56
|
def raw_content
|
60
|
-
|
57
|
+
runner_context.call(:instance).http_request('/videos/files/export').body
|
61
58
|
end
|
62
59
|
end
|
63
60
|
end
|
@@ -1,19 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_cli/core_ext'
|
4
|
-
require 'eac_ruby_utils/console/docopt_runner'
|
5
4
|
require 'ehbrs_ruby_utils/web_utils/videos/files_list'
|
6
5
|
require 'json'
|
7
6
|
require 'yaml'
|
8
7
|
|
9
8
|
module Ehbrs
|
10
|
-
class Runner
|
11
|
-
class WebUtils
|
12
|
-
class Videos
|
13
|
-
class Upload
|
14
|
-
runner_with
|
15
|
-
|
16
|
-
runner_definition do
|
9
|
+
class Runner
|
10
|
+
class WebUtils
|
11
|
+
class Videos
|
12
|
+
class Upload
|
13
|
+
runner_with :help do
|
17
14
|
desc 'Exporta informações de arquivos de vídeo para uma instância EHB/RS Utils.'
|
18
15
|
bool_opt '-P', '--no-ffprobe', 'Não recupera dados com "ffprobe".'
|
19
16
|
end
|
@@ -30,7 +27,7 @@ module Ehbrs
|
|
30
27
|
end
|
31
28
|
|
32
29
|
def upload_request(files_list_path)
|
33
|
-
|
30
|
+
runner_context.call(:instance).http_request(
|
34
31
|
'/videos/files/import',
|
35
32
|
method: :put,
|
36
33
|
body: {
|
@@ -65,8 +62,8 @@ module Ehbrs
|
|
65
62
|
def write_files_list(file_class, read_entry)
|
66
63
|
files_list = ::EhbrsRubyUtils::WebUtils::Videos::FilesList.new(
|
67
64
|
file_class,
|
68
|
-
|
69
|
-
ffprobe: !
|
65
|
+
runner_context.call(:instance).read_entry(read_entry),
|
66
|
+
ffprobe: !parsed.no_ffprobe?
|
70
67
|
)
|
71
68
|
infov 'Files found', files_list.data.fetch(:files).count
|
72
69
|
files_list.write_to
|
data/lib/ehbrs/tools/version.rb
CHANGED
@@ -6,21 +6,11 @@ module Ehbrs
|
|
6
6
|
module Rename
|
7
7
|
class File
|
8
8
|
class Options
|
9
|
-
|
10
|
-
|
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
|
-
|
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
|
@@ -12,7 +12,7 @@ Gem::Specification.new do |s|
|
|
12
12
|
|
13
13
|
s.files = Dir['{lib}/**/*', 'Gemfile']
|
14
14
|
|
15
|
-
s.add_dependency 'eac_ruby_utils', '~> 0.
|
15
|
+
s.add_dependency 'eac_ruby_utils', '~> 0.50'
|
16
16
|
|
17
17
|
s.add_development_dependency 'eac_ruby_gem_support', '~> 0.1', '>= 0.1.2'
|
18
18
|
end
|
@@ -8,6 +8,10 @@ require 'eac_ruby_utils/core_ext'
|
|
8
8
|
module EacCli
|
9
9
|
class Definition
|
10
10
|
require_sub __FILE__
|
11
|
+
|
12
|
+
SUBCOMMAND_NAME_ARG = 'subcommand'
|
13
|
+
SUBCOMMAND_ARGS_ARG = 'subcommand_args'
|
14
|
+
|
11
15
|
attr_accessor :description
|
12
16
|
attr_accessor :options_argument
|
13
17
|
|
@@ -50,15 +54,27 @@ module EacCli
|
|
50
54
|
end
|
51
55
|
|
52
56
|
def pos_arg(name, arg_options = {})
|
53
|
-
|
57
|
+
raise 'Positional arguments are blocked' if positional_arguments_blocked?
|
58
|
+
|
59
|
+
pos_set << ::EacCli::Definition::PositionalArgument.new(name, arg_options)
|
54
60
|
end
|
55
61
|
|
56
62
|
def positional
|
57
|
-
|
63
|
+
pos_set.to_a
|
64
|
+
end
|
65
|
+
|
66
|
+
def positional_arguments_blocked?
|
67
|
+
pos_set.any? { |e| e.optional? || e.repeat? }
|
58
68
|
end
|
59
69
|
|
60
70
|
def subcommands
|
61
|
-
|
71
|
+
pos_arg(SUBCOMMAND_NAME_ARG, subcommand: true)
|
72
|
+
pos_set << ::EacCli::Definition::PositionalArgument.new(SUBCOMMAND_ARGS_ARG,
|
73
|
+
optional: true, repeat: true)
|
74
|
+
end
|
75
|
+
|
76
|
+
def subcommands?
|
77
|
+
pos_set.any?(&:subcommand?)
|
62
78
|
end
|
63
79
|
|
64
80
|
def options_first(enable = true)
|
@@ -68,5 +84,11 @@ module EacCli
|
|
68
84
|
def options_first?
|
69
85
|
@options_first ? true : false
|
70
86
|
end
|
87
|
+
|
88
|
+
private
|
89
|
+
|
90
|
+
def pos_set
|
91
|
+
@pos_set ||= []
|
92
|
+
end
|
71
93
|
end
|
72
94
|
end
|
@@ -5,19 +5,35 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
module EacCli
|
6
6
|
class Definition
|
7
7
|
class BaseOption
|
8
|
+
DEFAULT_REQUIRED = false
|
9
|
+
|
10
|
+
enable_listable
|
11
|
+
lists.add_symbol :option, :optional, :usage, :required
|
8
12
|
attr_reader :short, :long, :description, :options
|
9
13
|
|
10
14
|
def initialize(short, long, description, options = {})
|
11
15
|
@short = short
|
12
16
|
@long = long
|
13
17
|
@description = description
|
14
|
-
@options = options.
|
18
|
+
@options = options.symbolize_keys
|
19
|
+
@options.assert_valid_keys(::EacCli::Definition::BaseOption.lists.option.values)
|
15
20
|
end
|
16
21
|
|
17
22
|
def identifier
|
18
23
|
long.to_s.variableize.to_sym
|
19
24
|
end
|
20
25
|
|
26
|
+
def required?
|
27
|
+
return true if options.key?(:required) && options.fetch(:required)
|
28
|
+
return false if options.key?(:optional) && options.fetch(:optional)
|
29
|
+
|
30
|
+
DEFAULT_REQUIRED
|
31
|
+
end
|
32
|
+
|
33
|
+
def to_s
|
34
|
+
"#{self.class.name.demodulize}[#{identifier}]"
|
35
|
+
end
|
36
|
+
|
21
37
|
def show_on_usage?
|
22
38
|
options[:usage]
|
23
39
|
end
|
@@ -5,22 +5,26 @@ require 'eac_ruby_utils/core_ext'
|
|
5
5
|
module EacCli
|
6
6
|
class Definition
|
7
7
|
class PositionalArgument
|
8
|
-
|
8
|
+
enable_listable
|
9
|
+
lists.add_symbol :option, :optional, :repeat, :subcommand
|
10
|
+
common_constructor :name, :options, default: [{}] do
|
11
|
+
options.assert_valid_keys(self.class.lists.option.values)
|
12
|
+
end
|
9
13
|
|
10
14
|
def identifier
|
11
15
|
name.to_s.variableize.to_sym
|
12
16
|
end
|
13
17
|
|
14
18
|
def optional?
|
15
|
-
options[
|
19
|
+
options[OPTION_OPTIONAL]
|
16
20
|
end
|
17
21
|
|
18
22
|
def repeat?
|
19
|
-
options[
|
23
|
+
options[OPTION_REPEAT]
|
20
24
|
end
|
21
25
|
|
22
26
|
def subcommand?
|
23
|
-
options[
|
27
|
+
options[OPTION_SUBCOMMAND]
|
24
28
|
end
|
25
29
|
end
|
26
30
|
end
|