ehbrs-tools 0.37.0 → 0.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -5
  3. data/Gemfile.lock +97 -60
  4. data/exe/ehbrs +1 -1
  5. data/lib/ehbrs/executables.rb +1 -8
  6. data/lib/ehbrs/google/translate/session.rb +1 -1
  7. data/lib/ehbrs/observers/base.rb +2 -3
  8. data/lib/ehbrs/observers/with_persistence.rb +1 -1
  9. data/lib/ehbrs/self/observers/with_persistence.rb +1 -1
  10. data/lib/ehbrs/tools/runner/finances/bb_browser.rb +4 -4
  11. data/lib/ehbrs/tools/runner/fs/used_space.rb +1 -1
  12. data/lib/ehbrs/tools/runner/google/translate.rb +1 -1
  13. data/lib/ehbrs/tools/runner/telegram/send_message.rb +3 -3
  14. data/lib/ehbrs/tools/runner/vg/ips.rb +2 -2
  15. data/lib/ehbrs/tools/runner/vg/ps2/rename.rb +34 -0
  16. data/lib/ehbrs/tools/runner/vg/ps2.rb +19 -0
  17. data/lib/ehbrs/tools/runner/videos/languages/file_runner.rb +2 -1
  18. data/lib/ehbrs/tools/runner/videos/languages.rb +1 -1
  19. data/lib/ehbrs/tools/runner/videos/series/rename.rb +1 -1
  20. data/lib/ehbrs/tools/runner/videos/subtitles/sanitize.rb +38 -0
  21. data/lib/ehbrs/tools/runner/videos/subtitles.rb +20 -0
  22. data/lib/ehbrs/tools/runner/videos/unsupported.rb +1 -1
  23. data/lib/ehbrs/tools/runner/web_utils/videos/upload.rb +1 -1
  24. data/lib/ehbrs/tools/runner_with/filesystem_renamer.rb +103 -0
  25. data/lib/ehbrs/tools/runner_with.rb +11 -0
  26. data/lib/ehbrs/tools/version.rb +1 -1
  27. data/lib/ehbrs/user_dirs.rb +1 -1
  28. data/lib/ehbrs/videos/convert_job.rb +3 -3
  29. data/lib/ehbrs/videos/extract/package_file.rb +1 -1
  30. data/lib/ehbrs/videos/file.rb +2 -2
  31. data/lib/ehbrs/videos/track.rb +3 -2
  32. data/lib/ehbrs/videos/unsupported/check_support.rb +5 -7
  33. data/lib/ehbrs/videos/unsupported/profiles/samsung.rb +1 -0
  34. metadata +20 -71
  35. data/.rspec +0 -1
  36. data/.rubocop.yml +0 -39
  37. data/lib/ehbrs/gems.rb +0 -37
  38. data/spec/code/rubocop_spec.rb +0 -3
  39. data/spec/lib/ehbrs/observers/base_spec.rb +0 -93
  40. data/spec/lib/ehbrs/tools/runner/fs/used_space_spec.rb +0 -62
  41. data/spec/lib/ehbrs/tools/runner/vg/ips_spec.rb +0 -31
  42. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/expected.rom +0 -0
  43. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_0.ips +0 -0
  44. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/patch_1.ips +0 -0
  45. data/spec/lib/ehbrs/tools/runner/vg/ips_spec_files/source.rom +0 -0
  46. data/spec/lib/ehbrs/tools/runner/videos/probe_spec.rb +0 -19
  47. data/spec/lib/ehbrs/tools/runner/videos/probe_spec_files/fixed.target.yaml +0 -105
  48. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec.rb +0 -75
  49. data/spec/lib/ehbrs/tools/runner/videos/unsupported_spec_files/dts_audio.probe.yaml +0 -91
  50. data/spec/lib/ehbrs/tools/runner_spec.rb +0 -16
  51. data/spec/spec_helper/videos.rb +0 -30
  52. data/spec/spec_helper/videos_files/stub_source.mp4 +0 -0
  53. data/spec/spec_helper.rb +0 -7
@@ -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__