ffprober 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bcb2bb4dcd2ba2306fd3f32b5b03095dfa3bc8d5
4
- data.tar.gz: 5441108c41049b6104757992599a96825b2fb2b6
3
+ metadata.gz: b29847084d8dbc8e10c2c4193b5957a6fcf08af9
4
+ data.tar.gz: 9fe8c79d5a88d4c4a5cf740e98ba55081b9c83ac
5
5
  SHA512:
6
- metadata.gz: 566b46750ba822e42be96b09c3b0a22d8652230fd6d3ba80c174a11e39294ff2086712d2df17388402b4fb9baa0c596a5030a6bf1496021f7712b44b86d2e2b0
7
- data.tar.gz: c0319d56f55b03cbd6817f77ec43c44a6ae7b9836eb1f6d65fd45cb1034ddb5fe8e6cfc8f8d70481d8dce8da04b9c08f876d1e85f7d50cc30e93fb12ff21b66a
6
+ metadata.gz: 72b340b1bbf4e915a1bcfb4dc6d6c10d99aefd74054e2f4a789607db5e8492950e9d2712d6739963c9e4583ac440e5c21c16a44d666f6e500fc227bd195cfbba
7
+ data.tar.gz: 421320686370ba7698fd688312fed908a3d1f10c63be8abcb734de04561bcfef42682dd564299e29e7c69041984cf5514e44ca04f92102f57dca06d0d55f3b4f
data/README.md CHANGED
@@ -31,6 +31,8 @@ tested with ffprobe version 0.9, 0.10, 0.11, 1.0, 1.1 and 1.2
31
31
 
32
32
  according to [ffmpeg changelog](http://git.videolan.org/?p=ffmpeg.git;a=blob_plain;f=Changelog) json output was added in version 0.9
33
33
 
34
+ [ffprobe documentation](http://www.ffmpeg.org/ffprobe.html)
35
+
34
36
  ## Supported Rubies
35
37
 
36
38
  Ffprober is tested under 1.9.3, 2.0, JRuby (1.9mode) and Rubinius (1.9mode) and ruby-head.
@@ -3,7 +3,7 @@ module Ffprober
3
3
  @@version_regex = /^ffprobe version (\d+)\.?(\d+)\.?(|\d+)$/
4
4
 
5
5
  MIN_VERSION = Gem::Version.new("0.9.0")
6
- MAX_VERSION = Gem::Version.new("1.2.0")
6
+ MAX_VERSION = Gem::Version.new("1.2.1")
7
7
 
8
8
  def self.valid?
9
9
  MIN_VERSION <= parsed_version && parsed_version <= MAX_VERSION
@@ -26,7 +26,11 @@ module Ffprober
26
26
  end
27
27
 
28
28
  def parsed_json
29
- @parsed_json ||= JSON.parse(@json_to_parse, symbolize_names: true)
29
+ @parsed_json ||= begin
30
+ json = JSON.parse(@json_to_parse, symbolize_names: true)
31
+ raise InvalidInputFileError.new("Invalid input file") if json.empty?
32
+ json
33
+ end
30
34
  end
31
35
 
32
36
  def format
@@ -1,3 +1,3 @@
1
1
  module Ffprober
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
data/lib/ffprober.rb CHANGED
@@ -20,4 +20,6 @@ module Ffprober
20
20
  path && File.expand_path(name, path)
21
21
  end
22
22
  end
23
+
24
+ class InvalidInputFileError < ::StandardError; end
23
25
  end
File without changes
@@ -22,6 +22,32 @@ describe Ffprober do
22
22
  end
23
23
  end
24
24
 
25
+ describe "from invalid file", if: Ffprober::FfprobeVersion.valid? do
26
+ before :each do
27
+ @ffprobe = Ffprober::Parser.from_file('spec/assets/empty_file')
28
+ end
29
+
30
+ describe "format" do
31
+ it "should determine the correct filename" do
32
+ expect do
33
+ @ffprobe.format.filename.should eq("spec/assets/empty_file")
34
+ end.to raise_error
35
+ end
36
+
37
+ it "should find the correct size" do
38
+ expect do
39
+ @ffprobe.format.size.should eq("130694")
40
+ end.to raise_error
41
+ end
42
+
43
+ it "should find the correct bit_rate" do
44
+ expect do
45
+ @ffprobe.format.bit_rate.should eq("502669")
46
+ end.to raise_error
47
+ end
48
+ end
49
+ end
50
+
25
51
  describe "if no ffprobe is found" do
26
52
  it "should raise a exception" do
27
53
  Ffprober.stub(:path).and_return("nonexistant")
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffprober
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - beanieboi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-05-15 00:00:00.000000000 Z
11
+ date: 2013-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -64,6 +64,7 @@ files:
64
64
  - lib/ffprober/video_stream.rb
65
65
  - spec/assets/301-extracting_a_ruby_gem.json
66
66
  - spec/assets/301-extracting_a_ruby_gem.m4v
67
+ - spec/assets/empty_file
67
68
  - spec/ffprober/ffprobe_version_spec.rb
68
69
  - spec/ffprober_spec.rb
69
70
  - spec/spec_helper.rb
@@ -94,6 +95,7 @@ summary: a Ruby wrapper for ffprobe (part of ffmpeg)
94
95
  test_files:
95
96
  - spec/assets/301-extracting_a_ruby_gem.json
96
97
  - spec/assets/301-extracting_a_ruby_gem.m4v
98
+ - spec/assets/empty_file
97
99
  - spec/ffprober/ffprobe_version_spec.rb
98
100
  - spec/ffprober_spec.rb
99
101
  - spec/spec_helper.rb