ffprober 0.0.2 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,7 +1,9 @@
1
1
  # FfprobeR
2
2
 
3
- a Ruby wrapper for ffprobe (part of ffmpeg)
4
- [![Build Status](https://secure.travis-ci.org/beanieboi/ffprober.png?branch=master)](http://travis-ci.org/beanieboi/ffprober)
3
+ a Ruby wrapper for ffprobe (which is part of ffmpeg)
4
+
5
+ ffprobe gathers information from multimedia streams and prints it in human- and machine-readable fashion.
6
+
5
7
 
6
8
  ## Installation
7
9
 
@@ -23,11 +25,17 @@ Or install it yourself as:
23
25
  ffprobe = Ffprober::Parser.from_file("my_awesome_video.mp4")
24
26
  ffprobe.size #=> 44772490
25
27
 
26
- ## TODOS
27
- a smarter way to determine the version of ffprobe
28
-
29
28
  ## FFMPEG version
30
- tested with ffprobe version 0.10.2
29
+
30
+ tested with ffprobe version 0.10.2 and 0.11.1
31
+
32
+ according to [ffmpeg changelog](http://git.videolan.org/?p=ffmpeg.git;a=blob_plain;f=Changelog) json out was added in version 0.9
33
+
34
+ ## Supported Rubies
35
+
36
+ OmniAuth Vimeo is tested under 1.9.2, 1.9.3, JRuby (1.9mode) and Rubinius (1.9mode).
37
+
38
+ [![Build Status](https://secure.travis-ci.org/beanieboi/ffprober.png?branch=master)](http://travis-ci.org/beanieboi/ffprober)
31
39
 
32
40
  ## Contributing
33
41
 
@@ -36,3 +44,14 @@ tested with ffprobe version 0.10.2
36
44
  3. Commit your changes (`git commit -am 'Added some feature'`)
37
45
  4. Push to the branch (`git push origin my-new-feature`)
38
46
  5. Create new Pull Request
47
+
48
+ ## License
49
+
50
+ Copyright (c) 2011 Benjamin Fritsch.
51
+
52
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
53
+
54
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
55
+
56
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
57
+
@@ -3,7 +3,7 @@ module Ffprober
3
3
  @@options = '-v quiet -print_format json -show_format -show_streams'
4
4
 
5
5
  def self.from_file(file_to_parse)
6
- raise ArgumentError.new("found unsupported ffprobe version") unless ffprobe_version_valid?
6
+ raise ArgumentError.new("no or unsupported ffprobe version found. (version: #{ffprobe_version})") unless ffprobe_version_valid?
7
7
 
8
8
  json_output = `#{ffprobe_path} #{@@options} #{file_to_parse}`
9
9
  from_json(json_output)
@@ -37,11 +37,16 @@ module Ffprober
37
37
  end
38
38
 
39
39
  def self.ffprobe_version_valid?
40
- !(ffprobe_version =~ /ffprobe version 0.10.2/).nil?
40
+ ffprobe_version[:minor] > 9
41
41
  end
42
42
 
43
43
  def self.ffprobe_version
44
- version = `#{ffprobe_path} -version`
44
+ version = `#{ffprobe_path} -version`.match(/^ffprobe version (?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/)
45
+ raise Errno::ENOENT if version.nil?
46
+ major, minor, patch = version[1].to_i, version[2].to_i, version[3].to_i
47
+ {major: major, minor: minor, patch: patch}
48
+ rescue Errno::ENOENT => e
49
+ {major: 0, minor: 0, patch: 0}
45
50
  end
46
51
 
47
52
  def self.ffprobe_path
@@ -1,3 +1,3 @@
1
1
  module Ffprober
2
- VERSION = "0.0.2"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -20,7 +20,13 @@ describe Ffprober do
20
20
  @ffprobe.format.bit_rate.should eq("502669")
21
21
  end
22
22
  end
23
+ end
23
24
 
25
+ describe "if no ffprobe is found" do
26
+ it "should raise a exception" do
27
+ Ffprober::Parser.stub(:ffprobe_path).and_return("nonexistant")
28
+ lambda { @ffprobe = Ffprober::Parser.from_file('spec/assets/301-extracting_a_ruby_gem.m4v') }.should raise_error
29
+ end
24
30
  end
25
31
 
26
32
  describe "from_json" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ffprober
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.1.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,41 +9,56 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-01 00:00:00.000000000 Z
12
+ date: 2012-06-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: rspec
16
- requirement: &70204608840140 !ruby/object:Gem::Requirement
17
- none: false
15
+ version_requirements: !ruby/object:Gem::Requirement
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
21
19
  version: '2.9'
22
- type: :development
20
+ none: false
23
21
  prerelease: false
24
- version_requirements: *70204608840140
25
- - !ruby/object:Gem::Dependency
26
- name: rake
27
- requirement: &70204608838580 !ruby/object:Gem::Requirement
22
+ type: :development
23
+ name: rspec
24
+ requirement: !ruby/object:Gem::Requirement
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ version: '2.9'
28
29
  none: false
30
+ - !ruby/object:Gem::Dependency
31
+ version_requirements: !ruby/object:Gem::Requirement
29
32
  requirements:
30
33
  - - ~>
31
34
  - !ruby/object:Gem::Version
32
35
  version: '0.9'
33
- type: :development
36
+ none: false
34
37
  prerelease: false
35
- version_requirements: *70204608838580
36
- - !ruby/object:Gem::Dependency
37
- name: multi_json
38
- requirement: &70204608836960 !ruby/object:Gem::Requirement
38
+ type: :development
39
+ name: rake
40
+ requirement: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: '0.9'
39
45
  none: false
46
+ - !ruby/object:Gem::Dependency
47
+ version_requirements: !ruby/object:Gem::Requirement
40
48
  requirements:
41
49
  - - ~>
42
50
  - !ruby/object:Gem::Version
43
51
  version: '1.3'
44
- type: :runtime
52
+ none: false
45
53
  prerelease: false
46
- version_requirements: *70204608836960
54
+ type: :runtime
55
+ name: multi_json
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ version: '1.3'
61
+ none: false
47
62
  description: a Ruby wrapper for ffprobe
48
63
  email:
49
64
  - beanie@benle.de
@@ -77,20 +92,20 @@ rdoc_options: []
77
92
  require_paths:
78
93
  - lib
79
94
  required_ruby_version: !ruby/object:Gem::Requirement
80
- none: false
81
95
  requirements:
82
96
  - - ! '>='
83
97
  - !ruby/object:Gem::Version
84
98
  version: 1.9.2
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
99
  none: false
100
+ required_rubygems_version: !ruby/object:Gem::Requirement
87
101
  requirements:
88
102
  - - ! '>='
89
103
  - !ruby/object:Gem::Version
90
104
  version: '0'
105
+ none: false
91
106
  requirements: []
92
107
  rubyforge_project: ffprober
93
- rubygems_version: 1.8.17
108
+ rubygems_version: 1.8.24
94
109
  signing_key:
95
110
  specification_version: 3
96
111
  summary: a Ruby wrapper for ffprobe (part of ffmpeg)