ehbrs_ruby_utils 0.4.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ehbrs_ruby_utils/version.rb +1 -1
- data/lib/ehbrs_ruby_utils/videos/container.rb +30 -2
- data/lib/ehbrs_ruby_utils/videos/convert_job.rb +1 -1
- data/lib/ehbrs_ruby_utils/videos/stream.rb +19 -3
- data/lib/ehbrs_ruby_utils/web_utils/videos/files_list.rb +1 -1
- metadata +21 -15
- data/lib/ehbrs_ruby_utils/videos/container/file.rb +0 -44
- data/lib/ehbrs_ruby_utils/videos/container/info.rb +0 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86d2b7290ba8a20d4c3f8a87ed7d3fecb6d4fd877d700524ce7c467a40f96cf7
|
4
|
+
data.tar.gz: f3817effe28180094b3d6fd1182d9bea026f7de3c98debdc1b13fd855eb8486a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3fac516de86eb3e88e7cc30263d5b97a94e8fd542d75fda8b0e3f49604ada03a1897f9bac167da3dff88e7668583e6dca223d65a8bfd2f92b6b6f5aa78ba9c6b
|
7
|
+
data.tar.gz: 07c97a47c7e2b7ece00d7a1f2ed0d4f929b189139ad27c505f7231f4d6891bbfc9976908ff5105b3766b303f19b06215260bc114371de7861c2dbfd63aa3c4e0
|
@@ -1,11 +1,39 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'eac_ruby_utils/core_ext'
|
4
|
+
require 'ehbrs_ruby_utils/executables'
|
5
|
+
require 'ehbrs_ruby_utils/videos/stream'
|
6
|
+
require 'json'
|
4
7
|
|
5
8
|
module EhbrsRubyUtils
|
6
9
|
module Videos
|
7
|
-
|
8
|
-
|
10
|
+
class Container
|
11
|
+
enable_simple_cache
|
12
|
+
common_constructor :path do
|
13
|
+
self.path = path.to_pathname
|
14
|
+
end
|
15
|
+
|
16
|
+
::EhbrsRubyUtils::Videos::Stream.lists.codec_type.each_value do |stream_type|
|
17
|
+
define_method stream_type.to_s.pluralize do
|
18
|
+
streams.select { |stream| stream.codec_type == stream_type }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def probe_data_uncached
|
25
|
+
::JSON.parse(
|
26
|
+
::EhbrsRubyUtils::Executables.ffprobe.command(
|
27
|
+
'-hide_banner', '-print_format', 'json', '-show_format', '-show_streams', path
|
28
|
+
).execute!
|
29
|
+
).deep_symbolize_keys.freeze
|
30
|
+
end
|
31
|
+
|
32
|
+
def streams_uncached
|
33
|
+
probe_data.fetch(:streams).map do |stream_ffprobe_data|
|
34
|
+
::EhbrsRubyUtils::Videos::Stream.new(stream_ffprobe_data)
|
35
|
+
end
|
36
|
+
end
|
9
37
|
end
|
10
38
|
end
|
11
39
|
end
|
@@ -8,13 +8,19 @@ module EhbrsRubyUtils
|
|
8
8
|
enable_simple_cache
|
9
9
|
enable_listable
|
10
10
|
|
11
|
-
lists.add_symbol :codec_type, :audio, :video, :subtitle, :
|
11
|
+
lists.add_symbol :codec_type, :audio, :video, :subtitle, :data, :attachment
|
12
12
|
|
13
13
|
common_constructor :ffprobe_data do
|
14
14
|
self.ffprobe_data = ffprobe_data.symbolize_keys.freeze
|
15
15
|
self.class.lists.codec_type.value_validate!(codec_type)
|
16
16
|
end
|
17
17
|
|
18
|
+
lists.codec_type.each_value do |v|
|
19
|
+
define_method "#{v}?" do
|
20
|
+
codec_type == v
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
18
24
|
def to_s
|
19
25
|
"#{index}|#{codec_type}|#{codec_name}|#{language}"
|
20
26
|
end
|
@@ -23,23 +29,33 @@ module EhbrsRubyUtils
|
|
23
29
|
ffprobe_data
|
24
30
|
end
|
25
31
|
|
26
|
-
%i[index
|
32
|
+
%i[index].each do |method_name|
|
27
33
|
define_method method_name do
|
28
34
|
ffprobe_data.fetch(method_name)
|
29
35
|
end
|
30
36
|
end
|
31
37
|
|
38
|
+
%i[codec_name codec_long_name].each do |method_name|
|
39
|
+
define_method method_name do
|
40
|
+
ffprobe_data[method_name]
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
32
44
|
def codec_type
|
33
45
|
ffprobe_data.fetch(:codec_type).to_sym
|
34
46
|
end
|
35
47
|
|
36
48
|
def tags
|
37
|
-
ffprobe_data
|
49
|
+
ffprobe_data[:tags].if_present({}, &:symbolize_keys)
|
38
50
|
end
|
39
51
|
|
40
52
|
def language
|
41
53
|
tags[:language]
|
42
54
|
end
|
55
|
+
|
56
|
+
def title
|
57
|
+
tags[:title]
|
58
|
+
end
|
43
59
|
end
|
44
60
|
end
|
45
61
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ehbrs_ruby_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo H. Bogoni
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: eac_ruby_utils
|
@@ -16,34 +16,42 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.70'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '0.
|
26
|
+
version: '0.70'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: aranha-parsers
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 0.1.1
|
33
|
+
version: '0.8'
|
37
34
|
type: :development
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0.
|
44
|
-
|
40
|
+
version: '0.8'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: eac_ruby_gem_support
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0.3'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
45
53
|
- !ruby/object:Gem::Version
|
46
|
-
version: 0.
|
54
|
+
version: '0.3'
|
47
55
|
description:
|
48
56
|
email:
|
49
57
|
executables: []
|
@@ -55,8 +63,6 @@ files:
|
|
55
63
|
- lib/ehbrs_ruby_utils/version.rb
|
56
64
|
- lib/ehbrs_ruby_utils/videos.rb
|
57
65
|
- lib/ehbrs_ruby_utils/videos/container.rb
|
58
|
-
- lib/ehbrs_ruby_utils/videos/container/file.rb
|
59
|
-
- lib/ehbrs_ruby_utils/videos/container/info.rb
|
60
66
|
- lib/ehbrs_ruby_utils/videos/convert_job.rb
|
61
67
|
- lib/ehbrs_ruby_utils/videos/quality.rb
|
62
68
|
- lib/ehbrs_ruby_utils/videos/resolution.rb
|
@@ -84,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
90
|
- !ruby/object:Gem::Version
|
85
91
|
version: '0'
|
86
92
|
requirements: []
|
87
|
-
rubygems_version: 3.
|
93
|
+
rubygems_version: 3.1.6
|
88
94
|
signing_key:
|
89
95
|
specification_version: 4
|
90
96
|
summary: Utilities for EHB/RS's Ruby projects.
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'json'
|
4
|
-
require 'eac_ruby_utils/core_ext'
|
5
|
-
require 'ehbrs_ruby_utils/executables'
|
6
|
-
require 'ehbrs_ruby_utils/videos/container/info'
|
7
|
-
require 'ehbrs_ruby_utils/videos/stream'
|
8
|
-
|
9
|
-
module EhbrsRubyUtils
|
10
|
-
module Videos
|
11
|
-
module Container
|
12
|
-
class File
|
13
|
-
enable_simple_cache
|
14
|
-
common_constructor :path do
|
15
|
-
self.path = path.to_pathname
|
16
|
-
end
|
17
|
-
|
18
|
-
::EhbrsRubyUtils::Videos::Stream.lists.codec_type.each_value do |stream_type|
|
19
|
-
define_method stream_type.to_s.pluralize do
|
20
|
-
streams.select { |stream| stream.codec_type == stream_type }
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def info_uncached
|
27
|
-
::EhbrsRubyUtils::Videos::Container::Info.new(
|
28
|
-
::JSON.parse(
|
29
|
-
::EhbrsRubyUtils::Executables.ffprobe.command(
|
30
|
-
'-hide_banner', '-print_format', 'json', '-show_format', '-show_streams', path
|
31
|
-
).execute!
|
32
|
-
)
|
33
|
-
)
|
34
|
-
end
|
35
|
-
|
36
|
-
def streams_uncached
|
37
|
-
info.ffprobe_data.fetch(:streams).map do |stream_ffprobe_data|
|
38
|
-
::EhbrsRubyUtils::Videos::Stream.new(stream_ffprobe_data)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
@@ -1,21 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'eac_ruby_utils/core_ext'
|
4
|
-
require 'ehbrs_ruby_utils/videos/container/info'
|
5
|
-
|
6
|
-
module EhbrsRubyUtils
|
7
|
-
module Videos
|
8
|
-
module Container
|
9
|
-
class Info
|
10
|
-
enable_simple_cache
|
11
|
-
common_constructor :ffprobe_data do
|
12
|
-
self.ffprobe_data = ffprobe_data.with_indifferent_access.freeze
|
13
|
-
end
|
14
|
-
|
15
|
-
def to_h
|
16
|
-
ffprobe_data
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
end
|