ehbrs-tools 0.37.0 → 0.38.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +37 -21
  3. data/lib/ehbrs/google/translate/session.rb +1 -1
  4. data/lib/ehbrs/self/observers/with_persistence.rb +1 -1
  5. data/lib/ehbrs/tools/runner/finances/bb_browser.rb +2 -2
  6. data/lib/ehbrs/tools/runner/telegram/send_message.rb +3 -3
  7. data/lib/ehbrs/tools/runner/vg/ips.rb +2 -2
  8. data/lib/ehbrs/tools/runner/videos/series/rename.rb +1 -1
  9. data/lib/ehbrs/tools/runner/videos/subtitles/sanitize.rb +38 -0
  10. data/lib/ehbrs/tools/runner/videos/subtitles.rb +20 -0
  11. data/lib/ehbrs/tools/runner/videos/unsupported.rb +1 -1
  12. data/lib/ehbrs/tools/version.rb +1 -1
  13. data/lib/ehbrs/videos/extract/package_file.rb +1 -1
  14. data/lib/ehbrs/videos/file.rb +1 -1
  15. data/lib/ehbrs/videos/unsupported/profiles/samsung.rb +1 -0
  16. metadata +22 -44
  17. data/.rspec +0 -1
  18. data/.rubocop.yml +0 -39
  19. data/spec/code/rubocop_spec.rb +0 -3
  20. data/spec/lib/ehbrs/observers/base_spec.rb +0 -93
  21. data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +0 -62
  22. data/spec/lib/ehbrs/tools/runner/vg/ips_spec.rb +0 -31
  23. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom +0 -0
  24. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips +0 -0
  25. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips +0 -0
  26. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom +0 -0
  27. data/spec/lib/ehbrs/tools/runner/videos/probe_spec.rb +0 -19
  28. data/spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml +0 -105
  29. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb +0 -75
  30. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml +0 -91
  31. data/spec/lib/ehbrs/tools/runner_spec.rb +0 -16
  32. data/spec/spec_helper/videos.rb +0 -30
  33. data/spec/spec_helper/videos_files/stub_source.mp4 +0 -0
  34. data/spec/spec_helper.rb +0 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d0db0050f90e36dc79b898e1d7b7aebf2586c85c8fd3df674f03035d802484d3
4
- data.tar.gz: 789d052e717913eae662e59fe1f9975d2960d2ba8e31cc087c6fefa42d79dcd8
3
+ metadata.gz: efdf00a40c51048bd3a312af6ff2919482f488aebdda650b372b0351b140c665
4
+ data.tar.gz: 53f183eac080097ba44aeefbb11844aa6b290552c04415291388f25114feac66
5
5
  SHA512:
6
- metadata.gz: 9de584955eacbd3ff6884ef57bf3c14a90b462dfb15b816cd08fa297fa94b9a9b82b77a7c31a8871ae37f2dc0a09d7786f074a576219404dbec6a83485a07a1b
7
- data.tar.gz: 3a648b506ac3867457dede4027da13fb85e76b6a367ba296f012b391f968e5bd6ec848d1aab3e70dce80f953c842161f9b9b6f65ce1d8adf8f8cb035938f8c9c
6
+ metadata.gz: ec429dacb5ec9a1a26021b8fad7cf7e0ab9dd184d4772c26cb7ea84ecf4e76f18718d4451cea2055a33e756cc9e4d8a3b5588d898415dbb15dd901a4c723ab57
7
+ data.tar.gz: f910b6b22feef5fe31096dc92748c6484b71905cf514059d29ade024be209dfea15eb703e9be734cbf3a13c245936abb22a4fb1c7974777c1f9abfb581fe54fc
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ehbrs-tools (0.37.0)
4
+ ehbrs-tools (0.38.0)
5
5
  avm-tools (~> 0.156)
6
6
  eac_cli (~> 0.38)
7
7
  eac_ruby_utils (~> 0.119, >= 0.119.2)
8
- ehbrs_ruby_utils (~> 0.35)
8
+ ehbrs_ruby_utils (~> 0.36, >= 0.36.1)
9
9
  filesize (~> 0.2)
10
10
  inifile (~> 3.0)
11
11
  os (~> 1.1, >= 1.1.4)
@@ -14,7 +14,7 @@ PATH
14
14
  PATH
15
15
  remote: sub/ehbrs_ruby_utils
16
16
  specs:
17
- ehbrs_ruby_utils (0.35.0)
17
+ ehbrs_ruby_utils (0.36.1)
18
18
  aranha (~> 0.19, >= 0.19.2)
19
19
  aranha-parsers (~> 0.21)
20
20
  aranha-selenium (~> 0.7)
@@ -24,6 +24,7 @@ PATH
24
24
  eac_rest (~> 0.10)
25
25
  eac_ruby_utils (~> 0.119, >= 0.119.2)
26
26
  eac_templates (~> 0.5)
27
+ srt (~> 0.1, >= 0.1.5)
27
28
  taglib-ruby (~> 1.1, >= 1.1.3)
28
29
  ultimate_lyrics (~> 0.1, >= 0.1.3)
29
30
 
@@ -158,12 +159,12 @@ GEM
158
159
  eac_cli (~> 0.35)
159
160
  eac_fs (~> 0.16)
160
161
  eac_ruby_utils (~> 0.117)
161
- eac_ruby_gem_support (0.5.1)
162
- eac_ruby_utils (~> 0.74)
163
- rspec (~> 3.9)
164
- rubocop (~> 0.80.1)
165
- rubocop-rails (~> 2.4.2)
166
- rubocop-rspec (~> 1.38.1)
162
+ eac_ruby_gem_support (0.8.2)
163
+ eac_ruby_utils (~> 0.119, >= 0.119.2)
164
+ rspec (~> 3.12)
165
+ rubocop (~> 1.57, >= 1.57.1)
166
+ rubocop-rails (~> 2.21, >= 2.21.2)
167
+ rubocop-rspec (~> 2.24, >= 2.24.1)
167
168
  eac_ruby_utils (0.119.2)
168
169
  activesupport (>= 4, < 7)
169
170
  addressable (~> 2.8, >= 2.8.5)
@@ -197,7 +198,8 @@ GEM
197
198
  concurrent-ruby (~> 1.0)
198
199
  ice_nine (0.11.2)
199
200
  inifile (3.0.0)
200
- jaro_winkler (1.5.6)
201
+ json (2.6.3)
202
+ language_server-protocol (3.17.0.3)
201
203
  minitar (0.9)
202
204
  minitest (5.20.0)
203
205
  multipart-post (2.3.0)
@@ -218,6 +220,7 @@ GEM
218
220
  rack (3.0.8)
219
221
  rainbow (3.1.1)
220
222
  rchardet (1.8.0)
223
+ regexp_parser (2.8.2)
221
224
  rexml (3.2.6)
222
225
  rspec (3.12.0)
223
226
  rspec-core (~> 3.12.0)
@@ -232,19 +235,31 @@ GEM
232
235
  diff-lcs (>= 1.2.0, < 2.0)
233
236
  rspec-support (~> 3.12.0)
234
237
  rspec-support (3.12.1)
235
- rubocop (0.80.1)
236
- jaro_winkler (~> 1.5.1)
238
+ rubocop (1.57.2)
239
+ json (~> 2.3)
240
+ language_server-protocol (>= 3.17.0)
237
241
  parallel (~> 1.10)
238
- parser (>= 2.7.0.1)
242
+ parser (>= 3.2.2.4)
239
243
  rainbow (>= 2.2.2, < 4.0)
240
- rexml
244
+ regexp_parser (>= 1.8, < 3.0)
245
+ rexml (>= 3.2.5, < 4.0)
246
+ rubocop-ast (>= 1.28.1, < 2.0)
241
247
  ruby-progressbar (~> 1.7)
242
- unicode-display_width (>= 1.4.0, < 1.7)
243
- rubocop-rails (2.4.2)
248
+ unicode-display_width (>= 2.4.0, < 3.0)
249
+ rubocop-ast (1.30.0)
250
+ parser (>= 3.2.1.0)
251
+ rubocop-capybara (2.19.0)
252
+ rubocop (~> 1.41)
253
+ rubocop-factory_bot (2.24.0)
254
+ rubocop (~> 1.33)
255
+ rubocop-rails (2.22.1)
256
+ activesupport (>= 4.2.0)
244
257
  rack (>= 1.1)
245
- rubocop (>= 0.72.0)
246
- rubocop-rspec (1.38.1)
247
- rubocop (>= 0.68.1)
258
+ rubocop (>= 1.33.0, < 2.0)
259
+ rubocop-rspec (2.25.0)
260
+ rubocop (~> 1.40)
261
+ rubocop-capybara (~> 2.17)
262
+ rubocop-factory_bot (~> 2.22)
248
263
  ruby-filemagic (0.7.3)
249
264
  ruby-progressbar (1.13.0)
250
265
  ruby2_keywords (0.0.5)
@@ -252,6 +267,7 @@ GEM
252
267
  selenium-webdriver (3.142.7)
253
268
  childprocess (>= 0.5, < 4.0)
254
269
  rubyzip (>= 1.2.2)
270
+ srt (0.1.5)
255
271
  taglib-ruby (1.1.3)
256
272
  telegram-bot-ruby (0.23.0)
257
273
  dry-inflector
@@ -264,7 +280,7 @@ GEM
264
280
  ultimate_lyrics (0.1.3)
265
281
  aranha-parsers (~> 0.10)
266
282
  eac_ruby_utils (~> 0.102, >= 0.102.1)
267
- unicode-display_width (1.6.1)
283
+ unicode-display_width (2.5.0)
268
284
  virtus (2.0.0)
269
285
  axiom-types (~> 0.1)
270
286
  coercible (~> 1.0)
@@ -276,7 +292,7 @@ PLATFORMS
276
292
  x86_64-linux
277
293
 
278
294
  DEPENDENCIES
279
- eac_ruby_gem_support (~> 0.5.1)
295
+ eac_ruby_gem_support (~> 0.8, >= 0.8.2)
280
296
  ehbrs-tools!
281
297
  ehbrs_ruby_utils!
282
298
 
@@ -10,7 +10,7 @@ module Ehbrs
10
10
  CLOSE_POPUP_CSS = '.dismiss-button'
11
11
  FILE_INPUT_XPATH = '//*[@id = "tlid-file-input"]'
12
12
  SUBMIT_XPATH = '//form[@action="//translate.googleusercontent.com/translate_f"]' \
13
- '//input[@type="submit"]'
13
+ '//input[@type="submit"]'
14
14
  RESULT_XPATHS = [
15
15
  '//script[contains(@src, "https://translate.google.com/translate_a")]',
16
16
  '/html/body/pre'
@@ -30,7 +30,7 @@ module Ehbrs
30
30
 
31
31
  def persistence_path_uncached
32
32
  ::Ehbrs::UserDirs.data.child('observers', label.to_s.parameterize)
33
- .content_path.to_pathname
33
+ .content_path.to_pathname
34
34
  end
35
35
  end
36
36
  end
@@ -25,8 +25,8 @@ module Ehbrs
25
25
 
26
26
  def docker_container_uncached
27
27
  r = docker_image.container
28
- .temporary(true).interactive(true).tty(true)
29
- .command_arg('seg.bb.com.br')
28
+ .temporary(true).interactive(true).tty(true)
29
+ .command_arg('seg.bb.com.br')
30
30
  %w[capabilities environment_variables volumes].inject(r) do |a, e|
31
31
  send("docker_container_#{e}", a)
32
32
  end
@@ -20,9 +20,9 @@ module Ehbrs
20
20
 
21
21
  def message_sending_uncached
22
22
  parsed.recipients_ids
23
- .inject(::Ehbrs::Telegram::MessageSending.new) { |a, e| a.recipient_id(e) }
24
- .bot_token(runner_context.call(:bot_token))
25
- .message(parsed.message)
23
+ .inject(::Ehbrs::Telegram::MessageSending.new) { |a, e| a.recipient_id(e) }
24
+ .bot_token(runner_context.call(:bot_token))
25
+ .message(parsed.message)
26
26
  end
27
27
  end
28
28
  end
@@ -36,14 +36,14 @@ module Ehbrs
36
36
 
37
37
  def run_patch(source_path, ips_path, output_path)
38
38
  command = ::Ehbrs::Executables.flips.command
39
- .append(['--apply', ips_path, source_path, output_path])
39
+ .append(['--apply', ips_path, source_path, output_path])
40
40
 
41
41
  command.system!
42
42
 
43
43
  return if output_path.exist?
44
44
 
45
45
  fatal_error("\"#{command}\" exited without error, but output file \"#{output_path}\"" \
46
- 'does not exist')
46
+ 'does not exist')
47
47
  end
48
48
 
49
49
  def run_patches
@@ -50,7 +50,7 @@ module Ehbrs
50
50
 
51
51
  def traverser_check_file(path)
52
52
  @files << ::EhbrsRubyUtils::Videos::Series::Rename::File
53
- .new(path, series_file_options)
53
+ .new(path, series_file_options)
54
54
  end
55
55
 
56
56
  def series_file_options_uncached
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/core_ext'
4
+ require 'ehbrs_ruby_utils/videos/subtitles/sanitize'
5
+
6
+ module Ehbrs
7
+ module Tools
8
+ class Runner
9
+ class Videos
10
+ class Subtitles
11
+ class Sanitize
12
+ runner_with :help, :filesystem_traverser do
13
+ desc 'Conserta legendas.'
14
+ end
15
+
16
+ def keep_languages?
17
+ keep_languages.present?
18
+ end
19
+
20
+ delegate :delete?, :extract?, to: :parsed
21
+
22
+ def run
23
+ run_filesystem_traverser
24
+ end
25
+
26
+ def traverser_check_file(file)
27
+ sub = ::EhbrsRubyUtils::Videos::Subtitles::Sanitize.new(file)
28
+ return unless sub.subtitle?
29
+
30
+ infov 'Subtitle found', sub.file
31
+ sub.run
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_base0/core_ext'
4
+
5
+ module Ehbrs
6
+ module Tools
7
+ class Runner
8
+ class Videos
9
+ class Subtitles
10
+ runner_with :help, :subcommands do
11
+ desc 'Ferramentas para seriados.'
12
+ subcommands
13
+ end
14
+
15
+ require_sub __FILE__
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -48,7 +48,7 @@ module Ehbrs
48
48
 
49
49
  def profiles_uncached
50
50
  parsed.profiles.if_present(PROFILES) { |v| v.split(',').map(&:strip) }
51
- .map { |name| profile_class(name).instance }
51
+ .map { |name| profile_class(name).instance }
52
52
  end
53
53
 
54
54
  def profile_class(profile_name)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.37.0'
5
+ VERSION = '0.38.0'
6
6
  end
7
7
  end
@@ -19,7 +19,7 @@ module Ehbrs
19
19
 
20
20
  def match_quality?(quality)
21
21
  path.basename_sub { |b| b.to_s.downcase }.basename
22
- .fnmatch?("*#{quality.downcase}*".gsub(/\A\*+/, '*').gsub(/\*+\z/, '*'))
22
+ .fnmatch?("*#{quality.downcase}*".gsub(/\A\*+/, '*').gsub(/\*+\z/, '*'))
23
23
  end
24
24
 
25
25
  def move_to_quality_dir
@@ -34,7 +34,7 @@ module Ehbrs
34
34
  end
35
35
 
36
36
  def hmsf_to_seconds(hour, minute, second, float_part)
37
- r = hour.to_f * 3600 + minute.to_f * 60 + second.to_f
37
+ r = (hour.to_f * 3600) + (minute.to_f * 60) + second.to_f
38
38
  r += float_part.to_f / (10**float_part.length) if float_part
39
39
  r
40
40
  end
@@ -23,6 +23,7 @@ module Ehbrs
23
23
  MPEG4_EXTRA_UNSUPPORTED = %w[dx50 xvid].freeze
24
24
 
25
25
  def initialize
26
+ super()
26
27
  add_check('invalid_extension', '.m4v')
27
28
  end
28
29
  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.37.0
4
+ version: 0.38.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: 2023-10-28 00:00:00.000000000 Z
11
+ date: 2023-10-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-tools
@@ -64,14 +64,20 @@ dependencies:
64
64
  requirements:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
- version: '0.35'
67
+ version: '0.36'
68
+ - - ">="
69
+ - !ruby/object:Gem::Version
70
+ version: 0.36.1
68
71
  type: :runtime
69
72
  prerelease: false
70
73
  version_requirements: !ruby/object:Gem::Requirement
71
74
  requirements:
72
75
  - - "~>"
73
76
  - !ruby/object:Gem::Version
74
- version: '0.35'
77
+ version: '0.36'
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: 0.36.1
75
81
  - !ruby/object:Gem::Dependency
76
82
  name: filesize
77
83
  requirement: !ruby/object:Gem::Requirement
@@ -140,14 +146,20 @@ dependencies:
140
146
  requirements:
141
147
  - - "~>"
142
148
  - !ruby/object:Gem::Version
143
- version: 0.5.1
149
+ version: '0.8'
150
+ - - ">="
151
+ - !ruby/object:Gem::Version
152
+ version: 0.8.2
144
153
  type: :development
145
154
  prerelease: false
146
155
  version_requirements: !ruby/object:Gem::Requirement
147
156
  requirements:
148
157
  - - "~>"
149
158
  - !ruby/object:Gem::Version
150
- version: 0.5.1
159
+ version: '0.8'
160
+ - - ">="
161
+ - !ruby/object:Gem::Version
162
+ version: 0.8.2
151
163
  description:
152
164
  email:
153
165
  executables:
@@ -156,8 +168,6 @@ extensions: []
156
168
  extra_rdoc_files: []
157
169
  files:
158
170
  - ".avm.yml"
159
- - ".rspec"
160
- - ".rubocop.yml"
161
171
  - Gemfile
162
172
  - Gemfile.lock
163
173
  - exe/ehbrs
@@ -211,6 +221,8 @@ files:
211
221
  - lib/ehbrs/tools/runner/videos/probe.rb
212
222
  - lib/ehbrs/tools/runner/videos/series.rb
213
223
  - lib/ehbrs/tools/runner/videos/series/rename.rb
224
+ - lib/ehbrs/tools/runner/videos/subtitles.rb
225
+ - lib/ehbrs/tools/runner/videos/subtitles/sanitize.rb
214
226
  - lib/ehbrs/tools/runner/videos/unsupported.rb
215
227
  - lib/ehbrs/tools/runner/web_utils.rb
216
228
  - lib/ehbrs/tools/runner/web_utils/finances.rb
@@ -251,22 +263,6 @@ files:
251
263
  - lib/ehbrs/videos/unsupported/profiles/samsung.rb
252
264
  - lib/ehbrs/videos/unsupported/search.rb
253
265
  - lib/ehbrs/videos/unsupported/track.rb
254
- - spec/code/rubocop_spec.rb
255
- - spec/lib/ehbrs/observers/base_spec.rb
256
- - spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb
257
- - spec/lib/ehbrs/tools/runner/vg/ips_spec.rb
258
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom
259
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips
260
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips
261
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom
262
- - spec/lib/ehbrs/tools/runner/videos/probe_spec.rb
263
- - spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml
264
- - spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb
265
- - spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml
266
- - spec/lib/ehbrs/tools/runner_spec.rb
267
- - spec/spec_helper.rb
268
- - spec/spec_helper/videos.rb
269
- - spec/spec_helper/videos_files/stub_source.mp4
270
266
  - template/ehbrs/cooking_book/build/base_page/layout.html.erb
271
267
  - template/ehbrs/cooking_book/build/index_page/inner.html.erb
272
268
  - template/ehbrs/cooking_book/build/recipe_page/inner.html.erb
@@ -282,7 +278,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
282
278
  requirements:
283
279
  - - ">="
284
280
  - !ruby/object:Gem::Version
285
- version: '0'
281
+ version: 2.7.0
286
282
  required_rubygems_version: !ruby/object:Gem::Requirement
287
283
  requirements:
288
284
  - - ">="
@@ -293,22 +289,4 @@ rubygems_version: 3.1.6
293
289
  signing_key:
294
290
  specification_version: 4
295
291
  summary: Tools for EHB/RS.
296
- test_files:
297
- - spec/spec_helper/videos_files/stub_source.mp4
298
- - spec/spec_helper/videos.rb
299
- - spec/lib/ehbrs/observers/base_spec.rb
300
- - spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb
301
- - spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb
302
- - spec/lib/ehbrs/tools/runner/videos/probe_spec.rb
303
- - spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml
304
- - spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml
305
- - spec/lib/ehbrs/tools/runner/vg/ips_spec.rb
306
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom
307
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom
308
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips
309
- - spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips
310
- - spec/lib/ehbrs/tools/runner_spec.rb
311
- - spec/spec_helper.rb
312
- - spec/code/rubocop_spec.rb
313
- - ".rubocop.yml"
314
- - ".rspec"
292
+ test_files: []
data/.rspec DELETED
@@ -1 +0,0 @@
1
- --require spec/spec_helper --color --format doc --default-path . --pattern 'spec/**/*_spec.rb'
data/.rubocop.yml DELETED
@@ -1,39 +0,0 @@
1
- require:
2
- - rubocop-rails
3
- - rubocop-rspec
4
-
5
- AllCops:
6
- Exclude:
7
- - sub/**/*
8
-
9
- Layout/LineLength:
10
- Max: 100
11
-
12
- Metrics/BlockLength:
13
- Exclude:
14
- - spec/**/*_spec.rb
15
-
16
- Rails/Output:
17
- Enabled: false
18
-
19
- Rails/TimeZone:
20
- Enabled: false
21
-
22
- RSpec/NestedGroups:
23
- Exclude:
24
- - spec/**/*_spec.rb
25
-
26
- Style/AsciiComments:
27
- Enabled: false
28
-
29
- Style/Documentation:
30
- Enabled: false
31
-
32
- Style/HashEachMethods:
33
- Enabled: true
34
-
35
- Style/HashTransformKeys:
36
- Enabled: true
37
-
38
- Style/HashTransformValues:
39
- Enabled: true
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- ::EacRubyUtils::Rspec.default_setup.describe_rubocop
@@ -1,93 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ehbrs/observers/base'
4
-
5
- RSpec.describe ::Ehbrs::Observers::Base do
6
- let(:instance) { described_class.new }
7
- let(:first_value) { 'a value' }
8
- let(:same_value) { first_value.dup }
9
- let(:different_value) { 'another value' }
10
- let(:first_time) { ::Time.required_zone.local(2020, 5, 1, 12, 45, 0) }
11
- let(:second_time) { ::Time.required_zone.local(2020, 5, 1, 12, 45, 0) }
12
-
13
- it { expect(instance.records.count).to be_zero }
14
- it { expect(instance.last_change_time).to be_blank }
15
- it { expect(instance.last_check_time).to be_blank }
16
-
17
- it { expect(instance).to be_changing_value(nil) }
18
- it { expect(instance).to be_changing_value(first_value) }
19
- it { expect(instance).to be_changing_value(same_value) }
20
- it { expect(instance).to be_changing_value(different_value) }
21
-
22
- context 'when firstly checked' do
23
- before { instance.check(first_value, first_time) }
24
-
25
- it { expect(instance.records.count).to eq(1) }
26
- it { expect(instance.last_value).to eq(first_value) }
27
- it { expect(instance).not_to be_changing_value(same_value) }
28
- it { expect(instance).to be_changing_value(different_value) }
29
- it { expect(instance.last_change_time).to eq(first_time) }
30
- it { expect(instance.last_check_time).to eq(first_time) }
31
-
32
- context 'when same first_value is checked' do
33
- before { instance.check(same_value, second_time) }
34
-
35
- it { expect(instance.records.count).to eq(1) }
36
- it { expect(instance.last_value).to eq(same_value) }
37
- it { expect(instance.last_change_time).to eq(first_time) }
38
- it { expect(instance.last_check_time).to eq(second_time) }
39
- end
40
-
41
- context 'when different first_value is checked' do
42
- before { instance.check(different_value, second_time) }
43
-
44
- it { expect(instance.records.count).to eq(2) }
45
- it { expect(instance.last_value).to eq(different_value) }
46
- it { expect(instance.last_change_time).to eq(second_time) }
47
- it { expect(instance.last_check_time).to eq(second_time) }
48
- end
49
-
50
- context 'when checked first_value is blank' do
51
- context 'when blank_value == :add' do
52
- let(:instance) { described_class.new(blank_value: :add) }
53
-
54
- before { instance.check(nil, second_time) }
55
-
56
- it { expect(instance.records.count).to eq(2) }
57
- it { expect(instance.last_value).to eq(nil) }
58
- it { expect(instance.last_change_time).to eq(second_time) }
59
- it { expect(instance.last_check_time).to eq(second_time) }
60
- end
61
-
62
- context 'when blank_value == :ignore' do
63
- let(:instance) { described_class.new(blank_value: :ignore) }
64
-
65
- before { instance.check(nil, second_time) }
66
-
67
- it { expect(instance.records.count).to eq(1) }
68
- it { expect(instance.last_value).to eq(first_value) }
69
- it { expect(instance.last_change_time).to eq(first_time) }
70
- it { expect(instance.last_check_time).to eq(second_time) }
71
- end
72
-
73
- context 'when blank_value == :raise' do
74
- let(:instance) { described_class.new(blank_value: :raise) }
75
-
76
- before do
77
- @exception = nil
78
- begin
79
- instance.check(nil, second_time)
80
- rescue StandardError => e
81
- @exception = e
82
- end
83
- end
84
-
85
- it { expect(@exception).to be_a(::ArgumentError) } # rubocop:disable RSpec/InstanceVariable
86
- it { expect(instance.records.count).to eq(1) }
87
- it { expect(instance.last_value).to eq(first_value) }
88
- it { expect(instance.last_change_time).to eq(first_time) }
89
- it { expect(instance.last_check_time).to eq(second_time) }
90
- end
91
- end
92
- end
93
- end
@@ -1,62 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_fs/storage_tree'
4
- require 'eac_ruby_utils/fs/temp'
5
- require 'ehbrs/tools/runner'
6
- require 'ehbrs/tools/runner/fs/used_space'
7
- require 'ehbrs/observers/with_persistence'
8
-
9
- RSpec.describe ::Ehbrs::Tools::Runner::Fs::UsedSpace do
10
- let(:target) { ::EacRubyUtils::Fs::Temp.directory }
11
- let(:user_dir) { ::EacRubyUtils::Fs::Temp.directory }
12
- let(:cached_user_dir) { ::EacFs::StorageTree.new(user_dir) }
13
- let(:observers_user_dir) { cached_user_dir.child('observers') }
14
- let(:observer_path) do
15
- observers_user_dir.child(target.to_s.parameterize).content_path.to_pathname
16
- end
17
-
18
- before do
19
- allow(::Ehbrs::UserDirs).to receive(:data).and_return(cached_user_dir)
20
- end
21
-
22
- after { [target, user_dir].each(&:remove!) }
23
-
24
- it { expect(observer_path).not_to exist }
25
- it { expect(cached_user_dir.path.to_pathname).to exist }
26
-
27
- %w[--check --verbose].bool_array_combs.each do |comb|
28
- it "run with options #{comb}" do
29
- expect { runner_run(*comb, target.to_path) }.not_to raise_error
30
- end
31
- end
32
-
33
- context 'when is firstly checked' do
34
- before { runner_run('--check', target.to_path) }
35
-
36
- it { expect(observer_path).to exist }
37
- it { expect(observer.records.count).to eq(1) }
38
-
39
- context 'when target does not change' do
40
- before { runner_run('--check', target.to_path) }
41
-
42
- it { expect(observer.records.count).to eq(1) }
43
- end
44
-
45
- context 'when target changes' do
46
- before do
47
- target.join('a_file').write('A' * 1024)
48
- runner_run('--check', target.to_path)
49
- end
50
-
51
- it { expect(observer.records.count).to eq(2) }
52
- end
53
- end
54
-
55
- def observer
56
- ::Ehbrs::Observers::WithPersistence.new(observer_path)
57
- end
58
-
59
- def runner_run(*args)
60
- ::Ehbrs::Tools::Runner.run(argv: %w[fs used-space] + args)
61
- end
62
- end
@@ -1,31 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/fs/temp'
4
- require 'ehbrs/tools/runner'
5
- require 'ehbrs/tools/runner/vg/ips'
6
-
7
- RSpec.describe ::Ehbrs::Tools::Runner::Vg::Ips do
8
- let(:source_dir) { ::Pathname.new('ips_spec_files').expand_path __dir__ }
9
- let(:source_file) { source_dir / 'source.rom' }
10
- let(:patches) { 2.times.map { |i| source_dir / "patch_#{i}.ips" } }
11
-
12
- describe '#run' do
13
- let(:output_file) { ::EacRubyUtils::Fs::Temp.file }
14
- let(:expected_file) { source_dir / 'expected.rom' }
15
- let(:run_argv) do
16
- ['vg', 'ips', '--output-file', output_file.to_path, source_file.to_path] +
17
- patches.map(&:to_path)
18
- end
19
-
20
- before do
21
- ::Ehbrs::Tools::Runner.run(argv: run_argv)
22
- end
23
-
24
- after do
25
- output_file.unlink if output_file.exist?
26
- end
27
-
28
- it { expect(output_file).to exist }
29
- it { expect(::FileUtils.compare_file(output_file.to_path, expected_file.to_path)).to be_truthy }
30
- end
31
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ehbrs/tools/runner'
4
-
5
- RSpec.describe ::Ehbrs::Tools::Runner::Videos::Probe do
6
- let(:source_file) { stub_video_source_file }
7
- let(:target_dir) { ::Pathname.new(__dir__).expand_path / 'probe_spec_files' }
8
- let(:target_file) { target_dir / 'fixed.target.yaml' }
9
- let(:target_content) { target_file.read.gsub('%%PATH%%', source_file.to_path) }
10
-
11
- let(:argv) { %w[videos probe] + [source_file.to_path] }
12
- let(:runner) { ::Ehbrs::Tools::Runner.create(argv: argv) }
13
-
14
- describe '#run' do
15
- it do
16
- expect { runner.run }.to(output(target_content).to_stdout_from_any_process)
17
- end
18
- end
19
- end
@@ -1,105 +0,0 @@
1
- ---
2
- :streams:
3
- - :index: 0
4
- :codec_name: h264
5
- :codec_long_name: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
6
- :profile: Constrained Baseline
7
- :codec_type: video
8
- :codec_tag_string: avc1
9
- :codec_tag: '0x31637661'
10
- :width: 352
11
- :height: 288
12
- :coded_width: 352
13
- :coded_height: 288
14
- :closed_captions: 0
15
- :has_b_frames: 0
16
- :sample_aspect_ratio: '1:1'
17
- :display_aspect_ratio: '11:9'
18
- :pix_fmt: yuv420p
19
- :level: 13
20
- :chroma_location: left
21
- :refs: 1
22
- :is_avc: 'true'
23
- :nal_length_size: '4'
24
- :r_frame_rate: 25/1
25
- :avg_frame_rate: 25/1
26
- :time_base: 1/25
27
- :start_pts: 0
28
- :start_time: '0.000000'
29
- :duration_ts: 168
30
- :duration: '6.720000'
31
- :bit_rate: '112583'
32
- :bits_per_raw_sample: '8'
33
- :nb_frames: '168'
34
- :disposition:
35
- :default: 1
36
- :dub: 0
37
- :original: 0
38
- :comment: 0
39
- :lyrics: 0
40
- :karaoke: 0
41
- :forced: 0
42
- :hearing_impaired: 0
43
- :visual_impaired: 0
44
- :clean_effects: 0
45
- :attached_pic: 0
46
- :timed_thumbnails: 0
47
- :tags:
48
- :language: und
49
- :handler_name: VideoHandler
50
- :vendor_id: "[0][0][0][0]"
51
- - :index: 1
52
- :codec_name: aac
53
- :codec_long_name: AAC (Advanced Audio Coding)
54
- :profile: LC
55
- :codec_type: audio
56
- :codec_tag_string: mp4a
57
- :codec_tag: '0x6134706d'
58
- :sample_fmt: fltp
59
- :sample_rate: '44100'
60
- :channels: 2
61
- :channel_layout: stereo
62
- :bits_per_sample: 0
63
- :r_frame_rate: 0/0
64
- :avg_frame_rate: 0/0
65
- :time_base: 1/44100
66
- :start_pts: 0
67
- :start_time: '0.000000'
68
- :duration_ts: 299008
69
- :duration: '6.780227'
70
- :bit_rate: '95999'
71
- :nb_frames: '292'
72
- :disposition:
73
- :default: 1
74
- :dub: 0
75
- :original: 0
76
- :comment: 0
77
- :lyrics: 0
78
- :karaoke: 0
79
- :forced: 0
80
- :hearing_impaired: 0
81
- :visual_impaired: 0
82
- :clean_effects: 0
83
- :attached_pic: 0
84
- :timed_thumbnails: 0
85
- :tags:
86
- :creation_time: '2015-05-17T06:08:17.000000Z'
87
- :language: und
88
- :handler_name: IsoMedia File Produced by Google, 5-11-2011
89
- :vendor_id: "[0][0][0][0]"
90
- :format:
91
- :filename: "%%PATH%%"
92
- :nb_streams: 2
93
- :nb_programs: 0
94
- :format_name: mov,mp4,m4a,3gp,3g2,mj2
95
- :format_long_name: QuickTime / MOV
96
- :start_time: '0.000000'
97
- :duration: '6.780000'
98
- :size: '179200'
99
- :bit_rate: '211445'
100
- :probe_score: 100
101
- :tags:
102
- :major_brand: mp42
103
- :minor_version: '0'
104
- :compatible_brands: isommp42
105
- :creation_time: '2015-05-17T06:08:17.000000Z'
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ehbrs/tools/runner'
4
- require 'eac_ruby_utils/fs/temp'
5
- require 'ehbrs/tools/runner/videos/unsupported'
6
- require 'ehbrs_ruby_utils/videos/container'
7
-
8
- RSpec.describe ::Ehbrs::Tools::Runner::Videos::Unsupported do
9
- let(:source_dir) { ::Pathname.new(__dir__).expand_path / 'unsupported_spec_files' }
10
- let(:temp_dir) { ::EacRubyUtils::Fs::Temp.directory }
11
- let(:dts_audio) do
12
- stub_video(['-c:v', 'copy', '-c:a', 'dts', '-strict', '-2'], temp_dir / 'to_fix_file.mp4')
13
- end
14
-
15
- ['dts_audio'].each do |video_var|
16
- context "when source file is #{video_var}" do
17
- let(:to_fix_file) { send(video_var) }
18
-
19
- before do
20
- to_fix_file
21
- end
22
-
23
- after do
24
- temp_dir.remove
25
- end
26
-
27
- it { expect(to_fix_file.file?).to eq(true) }
28
- it { expect(to_fix_file.dirname).to eq(temp_dir) }
29
-
30
- describe '#run' do
31
- let(:run_argv) { ['videos', 'unsupported', '-f', temp_dir.to_s] }
32
- let(:converted_file) { to_fix_file.basename_sub { |b| "#{b}.converted" } }
33
- let(:fixed_file) { to_fix_file.basename_sub { |b| "#{b.basename('.*')}.mkv" } }
34
- let(:fixed_file_actual_probe_data) do
35
- sanitize_probe_data(::EhbrsRubyUtils::Videos::Container.new(fixed_file).probe_data)
36
- end
37
-
38
- let(:fixed_file_expect_probe_file) { source_dir.join("#{video_var}.probe.yaml") }
39
- let(:fixed_file_expect_probe_data) do
40
- ::EacRubyUtils::Yaml.load_file(fixed_file_expect_probe_file)
41
- end
42
-
43
- before do
44
- ::Ehbrs::Tools::Runner.run(argv: run_argv)
45
- end
46
-
47
- it { expect(converted_file).to be_a_file }
48
- it { expect(fixed_file).to be_a_file }
49
-
50
- it 'has expected probe data' do
51
- expect(fixed_file_actual_probe_data).to eq(fixed_file_expect_probe_data)
52
- end
53
- end
54
-
55
- def sanitize_probe_data(data)
56
- sanitize_format_data(data.fetch(:format))
57
- data.fetch(:streams).each { |stream_data| sanitize_stream_data(stream_data) }
58
- data
59
- end
60
-
61
- def sanitize_stream_data(data)
62
- data[:tags].if_present do |v|
63
- %i[HANDLER_NAME ENCODER].each { |field| v.delete(field) }
64
- end
65
- end
66
-
67
- def sanitize_format_data(data)
68
- data.if_present do |v|
69
- %i[filename size bit_rate].each { |field| v.delete(field) }
70
- v[:tags].if_present { |vv| vv.delete(:ENCODER) }
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,91 +0,0 @@
1
- ---
2
- :streams:
3
- - :index: 0
4
- :codec_name: h264
5
- :codec_long_name: H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
6
- :profile: Constrained Baseline
7
- :codec_type: video
8
- :codec_tag_string: "[0][0][0][0]"
9
- :codec_tag: '0x0000'
10
- :width: 352
11
- :height: 288
12
- :coded_width: 352
13
- :coded_height: 288
14
- :closed_captions: 0
15
- :has_b_frames: 0
16
- :sample_aspect_ratio: '1:1'
17
- :display_aspect_ratio: '11:9'
18
- :pix_fmt: yuv420p
19
- :level: 13
20
- :chroma_location: left
21
- :field_order: progressive
22
- :refs: 1
23
- :is_avc: 'true'
24
- :nal_length_size: '4'
25
- :r_frame_rate: 25/1
26
- :avg_frame_rate: 25/1
27
- :time_base: 1/1000
28
- :start_pts: 23
29
- :start_time: '0.023000'
30
- :bits_per_raw_sample: '8'
31
- :disposition:
32
- :default: 1
33
- :dub: 0
34
- :original: 0
35
- :comment: 0
36
- :lyrics: 0
37
- :karaoke: 0
38
- :forced: 0
39
- :hearing_impaired: 0
40
- :visual_impaired: 0
41
- :clean_effects: 0
42
- :attached_pic: 0
43
- :timed_thumbnails: 0
44
- :tags:
45
- :VENDOR_ID: "[0][0][0][0]"
46
- :DURATION: '00:00:06.743000000'
47
- - :index: 1
48
- :codec_name: aac
49
- :codec_long_name: AAC (Advanced Audio Coding)
50
- :profile: LC
51
- :codec_type: audio
52
- :codec_tag_string: "[0][0][0][0]"
53
- :codec_tag: '0x0000'
54
- :sample_fmt: fltp
55
- :sample_rate: '44100'
56
- :channels: 2
57
- :channel_layout: stereo
58
- :bits_per_sample: 0
59
- :r_frame_rate: 0/0
60
- :avg_frame_rate: 0/0
61
- :time_base: 1/1000
62
- :start_pts: 0
63
- :start_time: '0.000000'
64
- :disposition:
65
- :default: 1
66
- :dub: 0
67
- :original: 0
68
- :comment: 0
69
- :lyrics: 0
70
- :karaoke: 0
71
- :forced: 0
72
- :hearing_impaired: 0
73
- :visual_impaired: 0
74
- :clean_effects: 0
75
- :attached_pic: 0
76
- :timed_thumbnails: 0
77
- :tags:
78
- :VENDOR_ID: "[0][0][0][0]"
79
- :DURATION: '00:00:06.803000000'
80
- :format:
81
- :nb_streams: 2
82
- :nb_programs: 0
83
- :format_name: matroska,webm
84
- :format_long_name: Matroska / WebM
85
- :start_time: '0.000000'
86
- :duration: '6.803000'
87
- :probe_score: 100
88
- :tags:
89
- :COMPATIBLE_BRANDS: isomiso2avc1mp41
90
- :MAJOR_BRAND: isom
91
- :MINOR_VERSION: '512'
@@ -1,16 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'ehbrs/tools/runner'
4
- require 'ehbrs/tools/version'
5
-
6
- RSpec.describe ::Ehbrs::Tools::Runner do
7
- let(:runner) { described_class.create(argv: argv) }
8
-
9
- describe '--version option' do
10
- let(:argv) { %w[--version] }
11
-
12
- it do
13
- expect { runner.run }.to(output("#{::Ehbrs::Tools::VERSION}\n").to_stdout_from_any_process)
14
- end
15
- end
16
- end
@@ -1,30 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/fs/temp'
4
-
5
- ::RSpec.configure do |config|
6
- config.before do
7
- videos_temp_dir
8
- end
9
-
10
- config.after do
11
- videos_temp_dir.remove
12
- end
13
-
14
- def videos_temp_dir
15
- @videos_temp_dir ||= ::EacRubyUtils::Fs::Temp.directory
16
- end
17
-
18
- def stub_video_source_file
19
- @stub_video_source_file ||= ::Pathname.new(__dir__).join('videos_files', 'stub_source.mp4')
20
- end
21
-
22
- def stub_video(ffmpeg_args, output_path = nil)
23
- output_path ||= videos_temp_dir.file
24
- ::Ehbrs::Executables.ffmpeg.command.append(
25
- ['-i', stub_video_source_file.to_s, *ffmpeg_args, output_path.to_s]
26
- ).execute!
27
-
28
- output_path
29
- end
30
- end
data/spec/spec_helper.rb DELETED
@@ -1,7 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/rspec/default_setup'
4
- ::EacRubyUtils::Rspec.default_setup_create(::File.expand_path('..', __dir__))
5
-
6
- require 'eac_ruby_utils/core_ext'
7
- ::EacRubyUtils.require_sub __FILE__