ehbrs-tools 0.39.0 → 0.39.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +40 -39
  3. data/lib/ehbrs/tools/runner/music/lyrics.rb +2 -2
  4. data/lib/ehbrs/tools/runner/music/lyrics_book.rb +1 -1
  5. data/lib/ehbrs/tools/runner/videos/extract.rb +2 -2
  6. data/lib/ehbrs/tools/runner/videos/languages/file_runner.rb +1 -1
  7. data/lib/ehbrs/tools/runner/videos/languages.rb +1 -1
  8. data/lib/ehbrs/tools/runner/videos/probe.rb +2 -2
  9. data/lib/ehbrs/tools/runner/videos/unsupported.rb +7 -7
  10. data/lib/ehbrs/tools/version.rb +1 -1
  11. metadata +4 -34
  12. data/lib/ehbrs/videos/convert_job.rb +0 -99
  13. data/lib/ehbrs/videos/extract/package.rb +0 -75
  14. data/lib/ehbrs/videos/extract/package_file.rb +0 -53
  15. data/lib/ehbrs/videos/extract.rb +0 -11
  16. data/lib/ehbrs/videos/file.rb +0 -67
  17. data/lib/ehbrs/videos/profiles/base.rb +0 -35
  18. data/lib/ehbrs/videos/profiles/same_quality.rb +0 -21
  19. data/lib/ehbrs/videos/track.rb +0 -20
  20. data/lib/ehbrs/videos/unsupported/check_result.rb +0 -24
  21. data/lib/ehbrs/videos/unsupported/check_set.rb +0 -43
  22. data/lib/ehbrs/videos/unsupported/check_support.rb +0 -71
  23. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb +0 -29
  24. data/lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb +0 -28
  25. data/lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb +0 -25
  26. data/lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb +0 -27
  27. data/lib/ehbrs/videos/unsupported/checks/invalid_extension.rb +0 -27
  28. data/lib/ehbrs/videos/unsupported/checks.rb +0 -13
  29. data/lib/ehbrs/videos/unsupported/file/fix.rb +0 -45
  30. data/lib/ehbrs/videos/unsupported/file.rb +0 -50
  31. data/lib/ehbrs/videos/unsupported/fix_profile.rb +0 -44
  32. data/lib/ehbrs/videos/unsupported/fixes/supported_codec.rb +0 -36
  33. data/lib/ehbrs/videos/unsupported/fixes/supported_container.rb +0 -17
  34. data/lib/ehbrs/videos/unsupported/profiles/aoc.rb +0 -27
  35. data/lib/ehbrs/videos/unsupported/profiles/base.rb +0 -116
  36. data/lib/ehbrs/videos/unsupported/profiles/philco.rb +0 -28
  37. data/lib/ehbrs/videos/unsupported/profiles/samsung.rb +0 -33
  38. data/lib/ehbrs/videos/unsupported/profiles.rb +0 -13
  39. data/lib/ehbrs/videos/unsupported/search.rb +0 -75
  40. data/lib/ehbrs/videos/unsupported/track.rb +0 -32
  41. data/lib/ehbrs/videos.rb +0 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 05eba951b36f326e76fa27e5264caecd9533f10ce8ec1f3775c6b6b10be3678b
4
- data.tar.gz: 1c6caca39da80381d76cd9cee1f8f40989b428d19e3a0d749e7cbf9fdb4f99b1
3
+ metadata.gz: 37d5bc6d09fd99c2b19fac22bbebd6c6817d88f1542d9eea927f7d40189be1b6
4
+ data.tar.gz: ae180d116b7de37be4e2f9a38aa9b06daa0ac6ef31631ed9c151ee46a140ee5e
5
5
  SHA512:
6
- metadata.gz: 38e39c046a9c1ba26c2624d3ba7769100ad1b4941c1bdac7eaa58d48d2d75da80d02c75fb99d94051498cd6efb245f650139ef70df978a4111e7327e4a118595
7
- data.tar.gz: acbaed41a43a3e7a9c9dea2afdddaf2704eee2033f208e3d400b739a484ba15c832f4c1fffafdd36d4797391d4d78762824c2d4a8481ed77711245515c27c07a
6
+ metadata.gz: f1294ab961b7a4ef0193cb25a582eea593930bdd9afb51850e2956c775de0094ad768a40b70e9f029285ee6880ee219294207f57a52156458e31c403000102c6
7
+ data.tar.gz: cdc973943f214f78198c8f8d31052b21a03c1c6b3dd51c9758b43fc55049063f691ac6181249f45688484f90bde0b177fd91c5d1f3b08d623861582b38736560
data/Gemfile.lock CHANGED
@@ -1,11 +1,11 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ehbrs-tools (0.39.0)
4
+ ehbrs-tools (0.39.1)
5
5
  avm-tools (~> 0.159)
6
6
  eac_cli (~> 0.40)
7
7
  eac_ruby_utils (~> 0.120)
8
- ehbrs_ruby_utils (~> 0.38)
8
+ ehbrs_ruby_utils (~> 0.41)
9
9
  filesize (~> 0.2)
10
10
  os (~> 1.1, >= 1.1.4)
11
11
  telegram-bot-ruby (~> 0.23)
@@ -22,14 +22,14 @@ PATH
22
22
  PATH
23
23
  remote: sub/ehbrs_ruby_utils
24
24
  specs:
25
- ehbrs_ruby_utils (0.38.0)
25
+ ehbrs_ruby_utils (0.41.0)
26
26
  aranha (~> 0.19, >= 0.19.2)
27
27
  aranha-parsers (~> 0.22)
28
- aranha-selenium (~> 0.7)
28
+ aranha-selenium (~> 0.8)
29
29
  avm (~> 0.84, >= 0.84.2)
30
- dentaku (~> 3.5, >= 3.5.1)
31
- eac_fs (~> 0.16)
32
- eac_rest (~> 0.10)
30
+ dentaku (~> 3.5, >= 3.5.2)
31
+ eac_fs (~> 0.17)
32
+ eac_rest (~> 0.12)
33
33
  eac_ruby_utils (~> 0.120)
34
34
  eac_templates (~> 0.5)
35
35
  inifile (~> 3.0)
@@ -46,7 +46,7 @@ GEM
46
46
  minitest (>= 5.1)
47
47
  tzinfo (~> 2.0)
48
48
  zeitwerk (~> 2.3)
49
- addressable (2.8.5)
49
+ addressable (2.8.6)
50
50
  public_suffix (>= 2.0.2, < 6.0)
51
51
  aranha (0.19.2)
52
52
  aranha-parsers (~> 0.18)
@@ -59,8 +59,9 @@ GEM
59
59
  eac_ruby_utils (~> 0.119, >= 0.119.2)
60
60
  nokogiri (~> 1.15, >= 1.15.4)
61
61
  ofx-parser (~> 1.1)
62
- aranha-selenium (0.7.0)
63
- eac_ruby_utils (~> 0.117, >= 0.117.1)
62
+ aranha-selenium (0.8.0)
63
+ eac_fs (~> 0.17)
64
+ eac_ruby_utils (~> 0.120)
64
65
  selenium-webdriver (~> 3.142, >= 3.142.7)
65
66
  ast (2.4.2)
66
67
  avm (0.84.2)
@@ -124,11 +125,11 @@ GEM
124
125
  coercible (1.0.0)
125
126
  descendants_tracker (~> 0.0.1)
126
127
  colorize (0.8.1)
127
- concurrent-ruby (1.2.2)
128
+ concurrent-ruby (1.2.3)
128
129
  content-type (0.0.2)
129
130
  parslet (~> 2.0)
130
131
  curb (0.9.11)
131
- dentaku (3.5.1)
132
+ dentaku (3.5.2)
132
133
  concurrent-ruby
133
134
  descendants_tracker (0.0.4)
134
135
  thread_safe (~> 0.3, >= 0.3.1)
@@ -140,25 +141,25 @@ GEM
140
141
  eac_docker (0.7.0)
141
142
  eac_ruby_utils (~> 0.112)
142
143
  eac_templates (~> 0.3, >= 0.3.2)
143
- eac_envs-http (0.4.1)
144
- eac_fs (~> 0.16)
145
- eac_ruby_utils (~> 0.119, >= 0.119.1)
146
- faraday (~> 2.7, >= 2.7.10)
144
+ eac_envs-http (0.5.1)
145
+ eac_fs (~> 0.17)
146
+ eac_ruby_utils (~> 0.120)
147
+ faraday (~> 2.7, >= 2.7.12)
147
148
  faraday-follow_redirects (~> 0.3)
148
149
  faraday-gzip (~> 0.1)
149
150
  faraday-multipart (~> 1.0, >= 1.0.4)
150
151
  faraday-retry (~> 2.2)
151
- eac_fs (0.16.0)
152
+ eac_fs (0.17.0)
152
153
  content-type (~> 0.0, >= 0.0.2)
153
- eac_ruby_utils (~> 0.107, >= 0.107.1)
154
+ eac_ruby_utils (~> 0.120)
154
155
  ruby-filemagic (~> 0.7, >= 0.7.3)
155
- eac_git (0.14.1)
156
- eac_ruby_utils (~> 0.112)
156
+ eac_git (0.15.0)
157
+ eac_ruby_utils (~> 0.120)
157
158
  parseconfig (~> 1.1, >= 1.1.2)
158
- eac_rest (0.10.0)
159
- eac_envs-http (~> 0.4, >= 0.4.1)
159
+ eac_rest (0.12.0)
160
+ eac_envs-http (~> 0.5)
160
161
  eac_fs (~> 0.16)
161
- eac_ruby_utils (~> 0.119, >= 0.119.1)
162
+ eac_ruby_utils (~> 0.120)
162
163
  eac_ruby_base0 (0.19.0)
163
164
  avm-eac_ruby_base1 (~> 0.30, >= 0.30.3)
164
165
  eac_cli (~> 0.35)
@@ -179,7 +180,7 @@ GEM
179
180
  eac_templates (0.5.0)
180
181
  eac_config (~> 0.12)
181
182
  eac_ruby_utils (~> 0.112)
182
- faraday (2.7.12)
183
+ faraday (2.8.1)
183
184
  base64
184
185
  faraday-net_http (>= 2.0, < 3.1)
185
186
  ruby2_keywords (>= 0.0.4)
@@ -194,7 +195,7 @@ GEM
194
195
  faraday-retry (2.2.0)
195
196
  faraday (~> 2.0)
196
197
  filesize (0.2.0)
197
- git (1.18.0)
198
+ git (1.19.1)
198
199
  addressable (~> 2.8)
199
200
  rchardet (~> 1.8)
200
201
  hpricot (0.8.6)
@@ -203,10 +204,10 @@ GEM
203
204
  concurrent-ruby (~> 1.0)
204
205
  ice_nine (0.11.2)
205
206
  inifile (3.0.0)
206
- json (2.6.3)
207
+ json (2.7.1)
207
208
  language_server-protocol (3.17.0.3)
208
209
  minitar (0.9)
209
- minitest (5.20.0)
210
+ minitest (5.21.1)
210
211
  multipart-post (2.3.0)
211
212
  net-ssh (4.2.0)
212
213
  nokogiri (1.15.5-x86_64-linux)
@@ -214,9 +215,9 @@ GEM
214
215
  ofx-parser (1.1.0)
215
216
  hpricot (>= 0.6)
216
217
  os (1.1.4)
217
- parallel (1.23.0)
218
+ parallel (1.24.0)
218
219
  parseconfig (1.1.2)
219
- parser (3.2.2.4)
220
+ parser (3.3.0.4)
220
221
  ast (~> 2.4.1)
221
222
  racc
222
223
  parslet (2.0.0)
@@ -227,7 +228,7 @@ GEM
227
228
  rack (3.0.8)
228
229
  rainbow (3.1.1)
229
230
  rchardet (1.8.0)
230
- regexp_parser (2.8.2)
231
+ regexp_parser (2.9.0)
231
232
  rexml (3.2.6)
232
233
  rspec (3.12.0)
233
234
  rspec-core (~> 3.12.0)
@@ -242,29 +243,29 @@ GEM
242
243
  diff-lcs (>= 1.2.0, < 2.0)
243
244
  rspec-support (~> 3.12.0)
244
245
  rspec-support (3.12.1)
245
- rubocop (1.57.2)
246
+ rubocop (1.60.0)
246
247
  json (~> 2.3)
247
248
  language_server-protocol (>= 3.17.0)
248
249
  parallel (~> 1.10)
249
- parser (>= 3.2.2.4)
250
+ parser (>= 3.3.0.2)
250
251
  rainbow (>= 2.2.2, < 4.0)
251
252
  regexp_parser (>= 1.8, < 3.0)
252
253
  rexml (>= 3.2.5, < 4.0)
253
- rubocop-ast (>= 1.28.1, < 2.0)
254
+ rubocop-ast (>= 1.30.0, < 2.0)
254
255
  ruby-progressbar (~> 1.7)
255
256
  unicode-display_width (>= 2.4.0, < 3.0)
256
257
  rubocop-ast (1.30.0)
257
258
  parser (>= 3.2.1.0)
258
- rubocop-capybara (2.19.0)
259
+ rubocop-capybara (2.20.0)
260
+ rubocop (~> 1.41)
261
+ rubocop-factory_bot (2.25.1)
259
262
  rubocop (~> 1.41)
260
- rubocop-factory_bot (2.24.0)
261
- rubocop (~> 1.33)
262
- rubocop-rails (2.22.2)
263
+ rubocop-rails (2.23.1)
263
264
  activesupport (>= 4.2.0)
264
265
  rack (>= 1.1)
265
266
  rubocop (>= 1.33.0, < 2.0)
266
267
  rubocop-ast (>= 1.30.0, < 2.0)
267
- rubocop-rspec (2.25.0)
268
+ rubocop-rspec (2.26.1)
268
269
  rubocop (~> 1.40)
269
270
  rubocop-capybara (~> 2.17)
270
271
  rubocop-factory_bot (~> 2.22)
@@ -289,7 +290,7 @@ GEM
289
290
  virtus (~> 2.0)
290
291
  thread_safe (0.3.6)
291
292
  tty-color (0.6.0)
292
- tty-screen (0.8.1)
293
+ tty-screen (0.8.2)
293
294
  tty-table (0.12.0)
294
295
  pastel (~> 0.8)
295
296
  strings (~> 0.2.0)
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'ehbrs/tools/core_ext'
4
- require 'ehbrs_ruby_utils/videos/container'
4
+ require 'ehbrs_ruby_utils/videos/file'
5
5
  require 'ultimate_lyrics/provider'
6
6
 
7
7
  module Ehbrs
@@ -39,7 +39,7 @@ module Ehbrs
39
39
  end
40
40
 
41
41
  def container_uncached
42
- ::EhbrsRubyUtils::Videos::Container.from_file(file)
42
+ ::EhbrsRubyUtils::Videos::File.from_file(file)
43
43
  end
44
44
 
45
45
  def file
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'ehbrs/tools/core_ext'
4
4
  require 'ehbrs_ruby_utils/music/lyrics_book'
5
- require 'ehbrs_ruby_utils/videos/container'
5
+ require 'ehbrs_ruby_utils/videos/file'
6
6
  require 'ultimate_lyrics/provider'
7
7
 
8
8
  module Ehbrs
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_cli/core_ext'
4
- require 'ehbrs/videos/extract/package'
4
+ require 'ehbrs_ruby_utils/videos2/extract/package'
5
5
 
6
6
  module Ehbrs
7
7
  module Tools
@@ -32,7 +32,7 @@ module Ehbrs
32
32
 
33
33
  def packages_uncached
34
34
  parsed.packages?.map do |p|
35
- ::Ehbrs::Videos::Extract::Package.new(p, target_dir, qualities)
35
+ ::EhbrsRubyUtils::Videos2::Extract::Package.new(p, target_dir, qualities)
36
36
  end
37
37
  end
38
38
 
@@ -53,7 +53,7 @@ module Ehbrs
53
53
  end
54
54
 
55
55
  def container_uncached
56
- ::EhbrsRubyUtils::Videos::Container.new(file)
56
+ ::EhbrsRubyUtils::Videos::File.new(file)
57
57
  end
58
58
 
59
59
  def track_label(track)
@@ -2,7 +2,7 @@
2
2
 
3
3
  require 'eac_ruby_base0/core_ext'
4
4
  require 'ehbrs/executables'
5
- require 'ehbrs_ruby_utils/videos/container'
5
+ require 'ehbrs_ruby_utils/videos/file'
6
6
  require 'ehbrs_ruby_utils/videos/convert_job'
7
7
 
8
8
  module Ehbrs
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'ehbrs_ruby_utils/videos/container'
3
+ require 'ehbrs_ruby_utils/videos/file'
4
4
  require 'eac_ruby_base0/core_ext'
5
5
  require 'eac_ruby_utils/yaml'
6
6
 
@@ -25,7 +25,7 @@ module Ehbrs
25
25
  private
26
26
 
27
27
  def container_file_uncached
28
- ::EhbrsRubyUtils::Videos::Container.new(parsed.file_path)
28
+ ::EhbrsRubyUtils::Videos::File.new(parsed.file_path)
29
29
  end
30
30
  end
31
31
  end
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'eac_cli/core_ext'
4
- require 'ehbrs/videos/unsupported/check_set'
5
- require 'ehbrs/videos/unsupported/search'
6
- require 'ehbrs/videos/unsupported/profiles'
4
+ require 'ehbrs_ruby_utils/videos2/unsupported/check_set'
5
+ require 'ehbrs_ruby_utils/videos2/unsupported/search'
6
+ require 'ehbrs_ruby_utils/videos2/unsupported/profiles'
7
7
 
8
8
  module Ehbrs
9
9
  module Tools
@@ -23,18 +23,18 @@ module Ehbrs
23
23
  infov 'Profiles', profiles.join(', ')
24
24
  infov 'Paths', paths
25
25
  paths.each do |d|
26
- ::Ehbrs::Videos::Unsupported::Search.new(d, file_options)
26
+ ::EhbrsRubyUtils::Videos2::Unsupported::Search.new(d, file_options)
27
27
  end
28
28
  end
29
29
 
30
30
  private
31
31
 
32
32
  def file_check_set_uncached
33
- ::Ehbrs::Videos::Unsupported::CheckSet.build(profiles, :file)
33
+ ::EhbrsRubyUtils::Videos2::Unsupported::CheckSet.build(profiles, :file)
34
34
  end
35
35
 
36
36
  def track_check_set_uncached
37
- ::Ehbrs::Videos::Unsupported::CheckSet.build(profiles, :track)
37
+ ::EhbrsRubyUtils::Videos2::Unsupported::CheckSet.build(profiles, :track)
38
38
  end
39
39
 
40
40
  def paths
@@ -52,7 +52,7 @@ module Ehbrs
52
52
  end
53
53
 
54
54
  def profile_class(profile_name)
55
- ::Ehbrs::Videos::Unsupported::Profiles.const_get(profile_name.camelize)
55
+ ::EhbrsRubyUtils::Videos2::Unsupported::Profiles.const_get(profile_name.camelize)
56
56
  end
57
57
  end
58
58
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ehbrs
4
4
  module Tools
5
- VERSION = '0.39.0'
5
+ VERSION = '0.39.1'
6
6
  end
7
7
  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.39.0
4
+ version: 0.39.1
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-11-26 00:00:00.000000000 Z
11
+ date: 2024-01-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: avm-tools
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '0.38'
61
+ version: '0.41'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '0.38'
68
+ version: '0.41'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: filesize
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -204,36 +204,6 @@ files:
204
204
  - lib/ehbrs/tools/runner_with/filesystem_renamer.rb
205
205
  - lib/ehbrs/tools/version.rb
206
206
  - lib/ehbrs/user_dirs.rb
207
- - lib/ehbrs/videos.rb
208
- - lib/ehbrs/videos/convert_job.rb
209
- - lib/ehbrs/videos/extract.rb
210
- - lib/ehbrs/videos/extract/package.rb
211
- - lib/ehbrs/videos/extract/package_file.rb
212
- - lib/ehbrs/videos/file.rb
213
- - lib/ehbrs/videos/profiles/base.rb
214
- - lib/ehbrs/videos/profiles/same_quality.rb
215
- - lib/ehbrs/videos/track.rb
216
- - lib/ehbrs/videos/unsupported/check_result.rb
217
- - lib/ehbrs/videos/unsupported/check_set.rb
218
- - lib/ehbrs/videos/unsupported/check_support.rb
219
- - lib/ehbrs/videos/unsupported/checks.rb
220
- - lib/ehbrs/videos/unsupported/checks/codec_extra_unlisted.rb
221
- - lib/ehbrs/videos/unsupported/checks/codec_extra_unsupported.rb
222
- - lib/ehbrs/videos/unsupported/checks/codec_unlisted.rb
223
- - lib/ehbrs/videos/unsupported/checks/codec_unsupported.rb
224
- - lib/ehbrs/videos/unsupported/checks/invalid_extension.rb
225
- - lib/ehbrs/videos/unsupported/file.rb
226
- - lib/ehbrs/videos/unsupported/file/fix.rb
227
- - lib/ehbrs/videos/unsupported/fix_profile.rb
228
- - lib/ehbrs/videos/unsupported/fixes/supported_codec.rb
229
- - lib/ehbrs/videos/unsupported/fixes/supported_container.rb
230
- - lib/ehbrs/videos/unsupported/profiles.rb
231
- - lib/ehbrs/videos/unsupported/profiles/aoc.rb
232
- - lib/ehbrs/videos/unsupported/profiles/base.rb
233
- - lib/ehbrs/videos/unsupported/profiles/philco.rb
234
- - lib/ehbrs/videos/unsupported/profiles/samsung.rb
235
- - lib/ehbrs/videos/unsupported/search.rb
236
- - lib/ehbrs/videos/unsupported/track.rb
237
207
  - template/ehbrs/cooking_book/build/base_page/layout.html.erb
238
208
  - template/ehbrs/cooking_book/build/index_page/inner.html.erb
239
209
  - template/ehbrs/cooking_book/build/recipe_page/inner.html.erb
@@ -1,99 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/executables'
5
- require 'fileutils'
6
-
7
- module Ehbrs
8
- module Videos
9
- class ConvertJob
10
- enable_speaker
11
- enable_simple_cache
12
-
13
- FORMATS_TO_EXTENSIONS = {
14
- 'matroska' => '.mkv'
15
- }.freeze
16
-
17
- attr_reader :input, :profile
18
-
19
- def initialize(input, profile)
20
- raise "Input file \"#{input}\" does not exist" unless ::File.exist?(input.to_s)
21
-
22
- @input = input
23
- @profile = profile
24
- end
25
-
26
- def run
27
- if ::File.exist?(converted)
28
- warn("Converted file already exist: \"#{converted}\"")
29
- else
30
- profile.run_callbacks(:convert) { convert }
31
- profile.run_callbacks(:swap) { swap }
32
- end
33
- end
34
-
35
- def target
36
- ::File.join(::File.dirname(input), "#{::File.basename(input, '.*')}#{target_extension}")
37
- end
38
-
39
- private
40
-
41
- def command_args_uncached
42
- r = ['-i', input] + profile_ffmpeg_args
43
- r += ['-f', format_by_input] if format_by_args.blank?
44
- r + [converting]
45
- end
46
-
47
- def convert
48
- infov 'Convert args', command_args.shelljoin
49
- ::EhbrsRubyUtils::Executables.ffmpeg.command.append(command_args).system!
50
- end
51
-
52
- def format_by_args_uncached
53
- profile_ffmpeg_args.rindex('-f').if_present do |option_index|
54
- profile_ffmpeg_args[option_index + 1]
55
- end
56
- end
57
-
58
- def format_by_input
59
- r = FORMATS_TO_EXTENSIONS.invert[target_extension_by_input]
60
- return if r.present?
61
-
62
- target_extension_by_input.gsub(/\A\./, '')
63
- end
64
-
65
- def format_to_extension(format)
66
- FORMATS_TO_EXTENSIONS[format].if_present(".#{format}")
67
- end
68
-
69
- def profile_ffmpeg_args_uncached
70
- profile.ffmpeg_args
71
- end
72
-
73
- def swap
74
- ::FileUtils.mv(input, converted)
75
- ::FileUtils.mv(converting, target)
76
- end
77
-
78
- def converting
79
- "#{target}.converting"
80
- end
81
-
82
- def converted
83
- input.basename_sub { |b| "#{b}.converted" }
84
- end
85
-
86
- def target_extension
87
- target_extension_by_args || target_extension_by_input
88
- end
89
-
90
- def target_extension_by_args
91
- format_by_args.if_present { |v| format_to_extension(v) }
92
- end
93
-
94
- def target_extension_by_input
95
- ::File.extname(input)
96
- end
97
- end
98
- end
99
- end
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
- require 'ehbrs_ruby_utils/fs/compressed_package'
5
- require 'ehbrs/videos/extract/package_file'
6
-
7
- module Ehbrs
8
- module Videos
9
- module Extract
10
- class Package
11
- enable_simple_cache
12
-
13
- common_constructor :path, :target_dir, :qualities do
14
- self.path = path.to_pathname
15
- self.target_dir = target_dir.to_pathname
16
- end
17
-
18
- delegate :to_s, to: :path
19
-
20
- def run(delete)
21
- selected_files.each(&:copy_to_selected_dir)
22
- files.each(&:move_to_quality_dir)
23
- extract_dir.rmdir
24
- path.unlink if delete
25
- end
26
-
27
- private
28
-
29
- def files_uncached
30
- ::Pathname.glob("#{extract_dir}/**/*").map do |file|
31
- ::Ehbrs::Videos::Extract::PackageFile.new(self, file)
32
- end
33
- end
34
-
35
- def extract_dir_uncached
36
- r = target_dir / path.basename
37
- raise "Extract directory \"#{r}\" is a file" if r.file?
38
-
39
- r.rmtree if r.directory?
40
- ::EhbrsRubyUtils::Fs::CompressedPackage.new(path).extract_to(r)
41
- r
42
- end
43
-
44
- def files_qualities_uncached
45
- qualities_with_default.select { |q| grouped_files.keys.include?(q) }
46
- end
47
-
48
- def grouped_files_uncached
49
- r = {}
50
- files.each do |file|
51
- r[file.quality] ||= []
52
- r[file.quality] << file
53
- end
54
- r
55
- end
56
-
57
- def qualities_with_default
58
- qualities + [::Ehbrs::Videos::Extract::PackageFile::DEFAULT_QUALITY]
59
- end
60
-
61
- def selected_dir_uncached
62
- target_dir / 'selected'
63
- end
64
-
65
- def selected_files
66
- files.select { |f| f.quality == selected_quality }
67
- end
68
-
69
- def selected_quality_uncached
70
- files_qualities.first
71
- end
72
- end
73
- end
74
- end
75
- end
@@ -1,53 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Ehbrs
6
- module Videos
7
- module Extract
8
- class PackageFile
9
- DEFAULT_QUALITY = '__default__'
10
-
11
- enable_simple_cache
12
- common_constructor :package, :path do
13
- self.path = path.to_pathname
14
- end
15
-
16
- def copy_to_selected_dir
17
- ::FileUtils.cp(path.to_path, selected_dir.to_path)
18
- end
19
-
20
- def match_quality?(quality)
21
- path.basename_sub { |b| b.to_s.downcase }.basename
22
- .fnmatch?("*#{quality.downcase}*".gsub(/\A\*+/, '*').gsub(/\*+\z/, '*'))
23
- end
24
-
25
- def move_to_quality_dir
26
- ::FileUtils.mv(path.to_path, quality_dir.to_path)
27
- end
28
-
29
- private
30
-
31
- def quality_uncached
32
- package.qualities.find { |q| match_quality?(q) } || DEFAULT_QUALITY
33
- end
34
-
35
- def quality_dir
36
- r = package.target_dir / quality
37
- r.mkpath
38
- r
39
- end
40
-
41
- def selected_dir
42
- r = nil
43
- r = package.target_dir / 'source' if /\.torrent/ =~ path.to_path
44
- r = package.target_dir / 'subtitle' if /\.srt/ =~ path.to_path
45
- raise "Destination unknown: #{path}" unless r
46
-
47
- r.mkpath
48
- r
49
- end
50
- end
51
- end
52
- end
53
- end
@@ -1,11 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'eac_ruby_utils/core_ext'
4
-
5
- module Ehbrs
6
- module Videos
7
- module Extract
8
- require_sub __FILE__
9
- end
10
- end
11
- end