ffprober 1.0 → 2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7d8c232d9ed83bd2d51a9ff879008d26deadc3ddf62970cca4e9e15ad118c01f
4
- data.tar.gz: b13c5c21ac3942019be942f242d06c3d63d577c9332940dbd1e7e2bb3768f364
3
+ metadata.gz: a4ae6b6e804fa457ca2276e953f75c9bfd51d26bc70d4f10d21c2aedf3725ebf
4
+ data.tar.gz: 799f5c09b76ba5425f12f713180f7c3aa529f5e89b67a0421fc615e740ddebdb
5
5
  SHA512:
6
- metadata.gz: 994061aa59b82948a63d753ca191c7a501e5d474117c67231ddd3131ef0574a51750693c697cafdd45269af7c29817619ef32a3405f5ac6988501ceef2d45b2e
7
- data.tar.gz: 1209f4ff0162d55cc019d5434d87b0236e6bbb6b13b87a58c0a665e97ebc2701e6a5668e08580348497e36e48210a8efd4897c317f7b376e4cbc849a2c3f9007
6
+ metadata.gz: 250dd782340f9d64761a3233a77bb2df38a7515332d61ebee4a568caa59be3c5465f16c689fd134c3b863a274cc4a78aadcbb4b14f9d64a6cccd2ed79d0a6992
7
+ data.tar.gz: 629c456d1809aff9250554c67a280a80e574377c8c679a2adf3dc6957ab1ac1b9d78d61fc9c3bc4a096a90db5bb260f324a777a0ec04f36835655166e8eb1313
data/CODE_OF_CONDUCT.md CHANGED
@@ -2,72 +2,131 @@
2
2
 
3
3
  ## Our Pledge
4
4
 
5
- In the interest of fostering an open and welcoming environment, we as
6
- contributors and maintainers pledge to making participation in our project and
7
- our community a harassment-free experience for everyone, regardless of age, body
8
- size, disability, ethnicity, gender identity and expression, level of experience,
9
- education, socio-economic status, nationality, personal appearance, race,
10
- religion, or sexual identity and orientation.
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, religion, or sexual identity
10
+ and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
11
14
 
12
15
  ## Our Standards
13
16
 
14
- Examples of behavior that contributes to creating a positive environment
15
- include:
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
16
19
 
17
- * Using welcoming and inclusive language
18
- * Being respectful of differing viewpoints and experiences
19
- * Gracefully accepting constructive criticism
20
- * Focusing on what is best for the community
21
- * Showing empathy towards other community members
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the
26
+ overall community
22
27
 
23
- Examples of unacceptable behavior by participants include:
28
+ Examples of unacceptable behavior include:
24
29
 
25
- * The use of sexualized language or imagery and unwelcome sexual attention or
26
- advances
27
- * Trolling, insulting/derogatory comments, and personal or political attacks
30
+ * The use of sexualized language or imagery, and sexual attention or
31
+ advances of any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
28
33
  * Public or private harassment
29
- * Publishing others' private information, such as a physical or electronic
30
- address, without explicit permission
34
+ * Publishing others' private information, such as a physical or email
35
+ address, without their explicit permission
31
36
  * Other conduct which could reasonably be considered inappropriate in a
32
37
  professional setting
33
38
 
34
- ## Our Responsibilities
39
+ ## Enforcement Responsibilities
35
40
 
36
- Project maintainers are responsible for clarifying the standards of acceptable
37
- behavior and are expected to take appropriate and fair corrective action in
38
- response to any instances of unacceptable behavior.
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
39
45
 
40
- Project maintainers have the right and responsibility to remove, edit, or
41
- reject comments, commits, code, wiki edits, issues, and other contributions
42
- that are not aligned to this Code of Conduct, or to ban temporarily or
43
- permanently any contributor for other behaviors that they deem inappropriate,
44
- threatening, offensive, or harmful.
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
45
50
 
46
51
  ## Scope
47
52
 
48
- This Code of Conduct applies both within project spaces and in public spaces
49
- when an individual is representing the project or its community. Examples of
50
- representing a project or community include using an official project e-mail
51
- address, posting via an official social media account, or acting as an appointed
52
- representative at an online or offline event. Representation of a project may be
53
- further defined and clarified by project maintainers.
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official e-mail address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
54
58
 
55
59
  ## Enforcement
56
60
 
57
61
  Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
- reported by contacting the project team at ich@abwesend.com. All
59
- complaints will be reviewed and investigated and will result in a response that
60
- is deemed necessary and appropriate to the circumstances. The project team is
61
- obligated to maintain confidentiality with regard to the reporter of an incident.
62
- Further details of specific enforcement policies may be posted separately.
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series
86
+ of actions.
63
87
 
64
- Project maintainers who do not follow or enforce the Code of Conduct in good
65
- faith may face temporary or permanent repercussions as determined by other
66
- members of the project's leadership.
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or
93
+ permanent ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within
113
+ the community.
67
114
 
68
115
  ## Attribution
69
116
 
70
- This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
- available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.0, available at
119
+ [https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available
126
+ at [https://www.contributor-covenant.org/translations][translations].
72
127
 
73
128
  [homepage]: https://www.contributor-covenant.org
129
+ [v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/Changes.md CHANGED
@@ -1,3 +1,12 @@
1
+ 2.0 / 2025-12-26
2
+ ==========
3
+
4
+ * added Ruby 4.0 support
5
+ * added Ruby 3.x support
6
+ * removed Sorbet types
7
+ * dropped support for older Ruby versions
8
+ * updated rake dependency to ~> 13.0
9
+
1
10
  1.0 / 2020-11-28
2
11
  ==========
3
12
 
data/Gemfile CHANGED
@@ -1,11 +1,18 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  source 'https://rubygems.org'
5
4
 
6
5
  group :test do
7
6
  gem 'simplecov'
8
- gem 'sorbet'
7
+ end
8
+
9
+ group :development do
10
+ gem 'minitest'
11
+ gem 'rake'
12
+ gem 'rubocop'
13
+ gem 'rubocop-minitest'
14
+ gem 'rubocop-packaging'
15
+ gem 'rubocop-rake'
9
16
  end
10
17
 
11
18
  # Specify your gem's dependencies in ffprober.gemspec
data/ffprober.gemspec CHANGED
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  lib = File.expand_path('lib', __dir__)
@@ -30,15 +29,9 @@ Gem::Specification.new do |spec|
30
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
30
  spec.require_paths = ['lib']
32
31
 
33
- spec.required_ruby_version = '>= 2.0'
32
+ spec.required_ruby_version = '>= 3.0'
34
33
 
35
- spec.add_runtime_dependency 'sorbet-runtime'
36
-
37
- spec.add_development_dependency 'minitest', '~> 5'
38
- spec.add_development_dependency 'rake', '~> 12.3'
39
- spec.add_development_dependency 'rubocop', '~> 1'
40
- spec.add_development_dependency 'rubocop-minitest'
41
- spec.add_development_dependency 'rubocop-packaging'
42
- spec.add_development_dependency 'rubocop-sorbet'
43
- spec.add_development_dependency 'simplecov', '~> 0.19'
34
+ spec.metadata = {
35
+ 'rubygems_mfa_required' => 'true'
36
+ }
44
37
  end
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
@@ -6,43 +6,34 @@ require 'shellwords'
6
6
  module Ffprober
7
7
  module Ffmpeg
8
8
  class Exec
9
- extend T::Sig
9
+ CHAPTER_SUPPORT = Gem::Version.new('2.0.0')
10
10
 
11
- CHAPTER_SUPPORT = T.let(Gem::Version.new('2.0.0'), Gem::Version)
12
-
13
- sig { params(finder: T.any(Ffprober::Ffmpeg::Finder, T.untyped)).void }
14
11
  def initialize(finder = Ffprober::Ffmpeg::Finder.new)
15
12
  @finder = finder
16
- @ffprobe_version_output = T.let(nil, T.nilable(String))
13
+ @ffprobe_version_output = nil
17
14
  end
18
15
 
19
- sig { params(filename: String).returns(String) }
20
16
  def json_output(filename)
21
17
  `#{@finder.path} #{ffprobe_options} #{Shellwords.escape(filename)}`
22
18
  end
23
19
 
24
- sig { returns(String) }
25
20
  def ffprobe_version_output
26
- @ffprobe_version_output ||= begin
27
- if @finder.path.nil?
28
- ''
29
- else
30
- `#{@finder.path} -version`
31
- end
32
- end
21
+ @ffprobe_version_output ||= if @finder.path.nil?
22
+ ''
23
+ else
24
+ `#{@finder.path} -version`
25
+ end
33
26
  end
34
27
 
35
- sig { returns(String) }
36
28
  def ffprobe_options
37
- base_options = '-v quiet -print_format json -show_format'\
38
- ' -show_streams -show_error'
29
+ base_options = '-v quiet -print_format json -show_format ' \
30
+ '-show_streams -show_error'
39
31
 
40
32
  options = "#{base_options} -show_chapters" if ffprobe_version.version >= CHAPTER_SUPPORT
41
33
 
42
34
  options || base_options
43
35
  end
44
36
 
45
- sig { returns(Ffprober::Ffmpeg::Version) }
46
37
  def ffprobe_version
47
38
  Ffprober::Ffmpeg::Version.new(self)
48
39
  end
@@ -1,49 +1,39 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
5
4
  module Ffmpeg
6
5
  class Finder
7
- extend T::Sig
8
- SEARCH_PATHS = T.let(ENV['PATH'], T.nilable(String))
6
+ SEARCH_PATHS = ENV.fetch('PATH', nil)
9
7
 
10
- sig { returns(String) }
11
8
  attr_reader :executable_name
12
9
 
13
- sig { void }
14
10
  def initialize
15
- @executable_path = T.let(nil, T.nilable(String))
16
- @executable_name = T.let(executable_name_picker, String)
17
- @path = T.let(nil, T.nilable(String))
11
+ @executable_path = nil
12
+ @executable_name = executable_name_picker
13
+ @path = nil
18
14
  end
19
15
 
20
- sig { returns(String) }
21
16
  def path
22
17
  raise Ffprober::NoFfprobeFound, 'ffprobe executable not found' if executable_path.nil?
23
18
 
24
19
  @path ||= File.expand_path(executable_name, executable_path)
25
20
  end
26
21
 
27
- sig { returns(T::Boolean) }
28
22
  def windows?
29
23
  !(RUBY_PLATFORM =~ /(mingw|mswin)/).nil?
30
24
  end
31
25
 
32
- sig { returns(String) }
33
26
  def executable_name_picker
34
27
  if windows?
35
- T.let('ffprobe.exe', String)
28
+ 'ffprobe.exe'
36
29
  else
37
- T.let('ffprobe', String)
30
+ 'ffprobe'
38
31
  end
39
32
  end
40
33
 
41
- sig { returns(T.nilable(String)) }
42
34
  def executable_path
43
- @executable_path ||= begin
44
- T.must(SEARCH_PATHS).split(File::PATH_SEPARATOR).detect do |path_to_check|
45
- File.executable?(File.join(path_to_check, executable_name))
46
- end
35
+ @executable_path ||= SEARCH_PATHS.split(File::PATH_SEPARATOR).detect do |path_to_check|
36
+ File.executable?(File.join(path_to_check, executable_name))
47
37
  end
48
38
  end
49
39
  end
@@ -4,32 +4,26 @@
4
4
  module Ffprober
5
5
  module Ffmpeg
6
6
  class Version
7
- extend T::Sig
8
-
9
- sig { params(ffprobe_exec: T.any(Ffprober::Ffmpeg::Exec, T.untyped)).void }
10
7
  def initialize(ffprobe_exec = Ffprober::Ffmpeg::Exec.new)
11
8
  @ffprobe_exec = ffprobe_exec
12
- @version = T.let(nil, T.nilable(Gem::Version))
13
- @parse_version = T.let(nil, T.nilable(T::Array[Integer]))
9
+ @version = nil
10
+ @parse_version = nil
14
11
  end
15
12
 
16
- VERSION_REGEX = T.let(/^(ffprobe|avprobe|ffmpeg) version (\d+)\.?(\d+)\.?(\d+)*/.freeze, Regexp)
17
- NIGHTLY_REGEX = T.let(/^(ffprobe|avprobe|ffmpeg) version (N|git)-/.freeze, Regexp)
18
- VERSION_FALLBACK = T.let([0, 0, 0].freeze, T::Array[Integer])
13
+ VERSION_REGEX = /^(ffprobe|avprobe|ffmpeg) version (\d+)\.?(\d+)\.?(\d+)*/
14
+ NIGHTLY_REGEX = /^(ffprobe|avprobe|ffmpeg) version (N|git)-/
15
+ VERSION_FALLBACK = [0, 0, 0].freeze
19
16
 
20
- sig { returns(Gem::Version) }
21
17
  def version
22
18
  @version ||= Gem::Version.new(parse_version.join('.'))
23
19
  end
24
20
 
25
- sig { returns(T::Boolean) }
26
21
  def nightly?
27
22
  !(ffprobe_version_output =~ NIGHTLY_REGEX).nil?
28
23
  end
29
24
 
30
25
  private
31
26
 
32
- sig { returns(T::Array[Integer]) }
33
27
  def parse_version
34
28
  return @parse_version if @parse_version
35
29
 
@@ -44,12 +38,10 @@ module Ffprober
44
38
  @parse_version
45
39
  end
46
40
 
47
- sig { returns(String) }
48
41
  def ffprobe_version_output
49
42
  @ffprobe_exec.ffprobe_version_output
50
43
  end
51
44
 
52
- sig { returns(String) }
53
45
  def to_s
54
46
  parse_version.join('.')
55
47
  end
@@ -4,28 +4,22 @@
4
4
  module Ffprober
5
5
  module Ffmpeg
6
6
  class VersionValidator
7
- extend T::Sig
7
+ MIN_VERSION = Gem::Version.new('0.9.0')
8
8
 
9
- MIN_VERSION = T.let(Gem::Version.new('0.9.0'), Gem::Version)
10
-
11
- sig { params(ffmpeg_version: Ffprober::Ffmpeg::Version).void }
12
9
  def initialize(ffmpeg_version)
13
10
  @ffmpeg_version = ffmpeg_version
14
11
  end
15
12
 
16
- sig { returns(T::Boolean) }
17
13
  def valid?
18
14
  ffmpeg_version.nightly? || version_requirement_statisfied?
19
15
  end
20
16
 
21
17
  private
22
18
 
23
- sig { returns(T::Boolean) }
24
19
  def version_requirement_statisfied?
25
- MIN_VERSION <= ffmpeg_version.version
20
+ ffmpeg_version.version >= MIN_VERSION
26
21
  end
27
22
 
28
- sig { returns(Ffprober::Ffmpeg::Version) }
29
23
  attr_reader :ffmpeg_version
30
24
  end
31
25
  end
@@ -3,38 +3,30 @@
3
3
 
4
4
  module Ffprober
5
5
  class FfprobeVersion
6
- extend T::Sig
7
-
8
- sig { returns(T::Boolean) }
9
6
  def self.invalid?
10
7
  !new.valid?
11
8
  end
12
9
 
13
- sig { returns(T::Boolean) }
14
10
  def self.valid?
15
11
  new.valid?
16
12
  rescue NoFfprobeFound
17
13
  false
18
14
  end
19
15
 
20
- sig { returns(T::Boolean) }
21
16
  def valid?
22
17
  validator.valid?
23
18
  end
24
19
 
25
- sig { returns(Ffprober::Ffmpeg::Version) }
26
20
  def self.version
27
21
  new.version
28
22
  end
29
23
 
30
- sig { returns(Ffprober::Ffmpeg::Version) }
31
24
  def version
32
25
  Ffprober::Ffmpeg::Version.new
33
26
  end
34
27
 
35
28
  private
36
29
 
37
- sig { returns(Ffprober::Ffmpeg::VersionValidator) }
38
30
  def validator
39
31
  Ffprober::Ffmpeg::VersionValidator.new(version)
40
32
  end
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
@@ -3,20 +3,16 @@
3
3
 
4
4
  module Ffprober
5
5
  class Parser
6
- extend T::Sig
7
-
8
- sig { params(file_to_parse: String).returns(Ffprober::Wrapper) }
9
6
  def self.from_file(file_to_parse)
10
7
  check_version
11
8
 
12
- raise EmptyInput, file_to_parse if File.zero?(file_to_parse)
9
+ raise EmptyInput, file_to_parse if File.empty?(file_to_parse)
13
10
 
14
11
  file_parser = Parsers::FileParser.new(file_to_parse)
15
12
  json_parser = file_parser.load
16
13
  Ffprober::Wrapper.new(json_parser.json)
17
14
  end
18
15
 
19
- sig { params(url_to_parse: T.untyped).returns(Ffprober::Wrapper) }
20
16
  def self.from_url(url_to_parse)
21
17
  check_version
22
18
 
@@ -25,13 +21,11 @@ module Ffprober
25
21
  Ffprober::Wrapper.new(json_parser.json)
26
22
  end
27
23
 
28
- sig { params(json_to_parse: T.untyped).returns(Ffprober::Wrapper) }
29
24
  def self.from_json(json_to_parse)
30
25
  json_parser = Parsers::JsonParser.new(json_to_parse)
31
26
  Ffprober::Wrapper.new(json_parser.json)
32
27
  end
33
28
 
34
- sig { returns(NilClass) }
35
29
  def self.check_version
36
30
  msg = "found version: #{FfprobeVersion.version}"
37
31
  raise UnsupportedVersion, msg if FfprobeVersion.invalid?
@@ -4,14 +4,6 @@
4
4
  module Ffprober
5
5
  module Parsers
6
6
  class FileParser
7
- extend T::Sig
8
-
9
- sig do
10
- params(
11
- file_to_parse: String,
12
- exec: T.any(Ffprober::Ffmpeg::Exec, T.untyped)
13
- ).void
14
- end
15
7
  def initialize(file_to_parse, exec = Ffprober::Ffmpeg::Exec.new)
16
8
  raise ArgumentError, "File not found #{file_to_parse}" unless ::File.exist?(file_to_parse)
17
9
 
@@ -19,7 +11,6 @@ module Ffprober
19
11
  @exec = exec
20
12
  end
21
13
 
22
- sig { returns(Ffprober::Parsers::JsonParser) }
23
14
  def load
24
15
  JsonParser.new(@exec.json_output(@file_to_parse))
25
16
  end
@@ -6,7 +6,11 @@ require 'uri'
6
6
  module Ffprober
7
7
  module Parsers
8
8
  class UrlParser
9
- VALID_URI_REGEX = /\A#{URI::DEFAULT_PARSER.make_regexp}\z/.freeze
9
+ VALID_URI_REGEX = if RUBY_VERSION >= '3.2.0'
10
+ /\A#{URI::RFC2396_PARSER.make_regexp}\z/
11
+ else
12
+ /\A#{URI::DEFAULT_PARSER.make_regexp}\z/
13
+ end
10
14
 
11
15
  def initialize(url_to_parse, exec = Ffprober::Ffmpeg::Exec.new)
12
16
  raise ArgumentError, "#{url_to_parse} is not a valid URL" unless valid_url?(url_to_parse)
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
@@ -1,6 +1,5 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
5
- VERSION = '1.0'
4
+ VERSION = '2.0'
6
5
  end
@@ -1,4 +1,3 @@
1
- # typed: strong
2
1
  # frozen_string_literal: true
3
2
 
4
3
  module Ffprober
@@ -3,55 +3,44 @@
3
3
 
4
4
  module Ffprober
5
5
  class Wrapper
6
- extend T::Sig
7
-
8
6
  attr_reader :json
9
7
 
10
- sig { returns(Ffprober::Format) }
11
8
  attr_reader :format
12
9
 
13
- # rubocop:disable Metrics/AbcSize
14
- sig { params(json: T::Hash[T.untyped, T.untyped]).void }
15
10
  def initialize(json)
16
11
  raise FfprobeError, json[:error] if json[:error]
17
12
 
18
13
  @json = json
19
- @format = T.let(Format.new(json[:format]), Ffprober::Format)
20
- @video_streams = T.let(nil, T.nilable(T::Array[Ffprober::VideoStream]))
21
- @audio_streams = T.let(nil, T.nilable(T::Array[Ffprober::AudioStream]))
22
- @data_streams = T.let(nil, T.nilable(T::Array[Ffprober::DataStream]))
23
- @subtitle_streams = T.let(nil, T.nilable(T::Array[Ffprober::SubtitleStream]))
24
- @chapters = T.let(nil, T.nilable(T::Array[Ffprober::Chapter]))
14
+ @format = Format.new(json[:format])
15
+ @video_streams = nil
16
+ @audio_streams = nil
17
+ @data_streams = nil
18
+ @subtitle_streams = nil
19
+ @chapters = nil
25
20
  end
26
- # rubocop:enable Metrics/AbcSize
27
21
 
28
- sig { returns(T::Array[Ffprober::VideoStream]) }
29
22
  def video_streams
30
23
  @video_streams ||= stream_by_codec('video').map do |data|
31
24
  VideoStream.new(data)
32
25
  end
33
26
  end
34
27
 
35
- sig { returns(T::Array[Ffprober::AudioStream]) }
36
28
  def audio_streams
37
29
  @audio_streams ||= stream_by_codec('audio').map do |data|
38
30
  AudioStream.new(data)
39
31
  end
40
32
  end
41
33
 
42
- sig { returns(T::Array[Ffprober::DataStream]) }
43
34
  def data_streams
44
35
  @data_streams ||= stream_by_codec('data').map do |data|
45
36
  DataStream.new(data)
46
37
  end
47
38
  end
48
39
 
49
- sig { returns(T::Array[Ffprober::Chapter]) }
50
40
  def chapters
51
41
  @chapters ||= json[:chapters].map { |chapter| Chapter.new(chapter) }
52
42
  end
53
43
 
54
- sig { returns(T::Array[Ffprober::SubtitleStream]) }
55
44
  def subtitle_streams
56
45
  @subtitle_streams ||= stream_by_codec('subtitle').map do |stream|
57
46
  SubtitleStream.new(stream)
data/lib/ffprober.rb CHANGED
@@ -4,7 +4,6 @@
4
4
  require 'bundler'
5
5
  Bundler.setup
6
6
 
7
- require 'sorbet-runtime'
8
7
  require_relative 'ffprober/version'
9
8
 
10
9
  autoload :JSON, 'json'
metadata CHANGED
@@ -1,127 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffprober
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
4
+ version: '2.0'
5
5
  platform: ruby
6
6
  authors:
7
7
  - beanieboi
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2020-11-28 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: sorbet-runtime
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: minitest
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '5'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '5'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '12.3'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '12.3'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1'
69
- - !ruby/object:Gem::Dependency
70
- name: rubocop-minitest
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop-packaging
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-sorbet
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: simplecov
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.19'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - "~>"
123
- - !ruby/object:Gem::Version
124
- version: '0.19'
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
+ dependencies: []
125
12
  description: a Ruby wrapper for ffprobe
126
13
  email:
127
14
  - beanie@benle.de
@@ -159,8 +46,8 @@ files:
159
46
  homepage: https://github.com/beanieboi/ffprober
160
47
  licenses:
161
48
  - MIT
162
- metadata: {}
163
- post_install_message:
49
+ metadata:
50
+ rubygems_mfa_required: 'true'
164
51
  rdoc_options: []
165
52
  require_paths:
166
53
  - lib
@@ -168,15 +55,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
168
55
  requirements:
169
56
  - - ">="
170
57
  - !ruby/object:Gem::Version
171
- version: '2.0'
58
+ version: '3.0'
172
59
  required_rubygems_version: !ruby/object:Gem::Requirement
173
60
  requirements:
174
61
  - - ">="
175
62
  - !ruby/object:Gem::Version
176
63
  version: '0'
177
64
  requirements: []
178
- rubygems_version: 3.1.4
179
- signing_key:
65
+ rubygems_version: 4.0.3
180
66
  specification_version: 4
181
67
  summary: a Ruby wrapper for ffprobe (part of ffmpeg)
182
68
  test_files: []