ffprober 0.2.1 → 0.2.2

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: 919d1151ce185635625a4202ef066333408afc39
4
- data.tar.gz: 0fc63f7d15e762393ce4a858eca5370ad8bd9084
3
+ metadata.gz: bcb2bb4dcd2ba2306fd3f32b5b03095dfa3bc8d5
4
+ data.tar.gz: 5441108c41049b6104757992599a96825b2fb2b6
5
5
  SHA512:
6
- metadata.gz: 62cebe986fd0545a230c2c5ed1701f9dc155cb18c4c12fab95db66eb847a55c682641243d3edfacffde556cad12bb0ea1dedfec4aa94ac854e7e28c89da27dc3
7
- data.tar.gz: f6b348f46fd23c2c385fd2d3813c7d17caad9b439a880b443023ba1a464ef1bf0228b595e9a838db9fa8684da1ea090811d0a6ade6719b74688ee18cdee3c5ee
6
+ metadata.gz: 566b46750ba822e42be96b09c3b0a22d8652230fd6d3ba80c174a11e39294ff2086712d2df17388402b4fb9baa0c596a5030a6bf1496021f7712b44b86d2e2b0
7
+ data.tar.gz: c0319d56f55b03cbd6817f77ec43c44a6ae7b9836eb1f6d65fd45cb1034ddb5fe8e6cfc8f8d70481d8dce8da04b9c08f876d1e85f7d50cc30e93fb12ff21b66a
@@ -1,14 +1,11 @@
1
1
  module Ffprober
2
2
  class Format
3
- attr_accessor :filename, :nb_streams, :format_name,
4
- :format_long_name, :start_time, :duration,
5
- :size, :bit_rate
3
+ attr_reader :filename, :nb_streams, :format_name,
4
+ :format_long_name, :start_time, :duration,
5
+ :size, :bit_rate
6
6
 
7
7
  def initialize(object_attribute_hash)
8
- object_attribute_hash.map do |(k, v)|
9
- writer_m = "#{k}="
10
- send(writer_m, v) if respond_to?(writer_m)
11
- end
8
+ object_attribute_hash.each {|k,v| instance_variable_set("@#{k}",v)}
12
9
  end
13
10
  end
14
11
  end
@@ -30,19 +30,19 @@ module Ffprober
30
30
  end
31
31
 
32
32
  def format
33
- Ffprober::Format.new(parsed_json[:format])
33
+ @format ||= Ffprober::Format.new(parsed_json[:format])
34
34
  end
35
35
 
36
36
  def video_streams
37
- streams.select { |stream| stream[:codec_type] == 'video'}.map do |s|
38
- Ffprober::VideoStream.new(s)
39
- end
37
+ @video_streams ||= stream_by_codec('video').map { |s| Ffprober::VideoStream.new(s) }
40
38
  end
41
39
 
42
40
  def audio_streams
43
- streams.select { |stream| stream[:codec_type] == 'audio'}.map do |s|
44
- Ffprober::AudioStream.new(s)
45
- end
41
+ @audio_streams ||= stream_by_codec('audio').map { |s| Ffprober::AudioStream.new(s) }
42
+ end
43
+
44
+ def stream_by_codec(codec_type)
45
+ streams.select { |stream| stream[:codec_type] == codec_type }
46
46
  end
47
47
 
48
48
  def streams
@@ -1,16 +1,13 @@
1
1
  module Ffprober
2
2
  class Stream
3
- attr_accessor :codec_name, :codec_long_name, :codec_type,
4
- :codec_time_base, :codec_tag_string, :codec_tag,
5
- :r_frame_rate, :avg_frame_rate,
6
- :time_base, :start_time, :duration,
7
- :nb_frames
3
+ attr_reader :codec_name, :codec_long_name, :codec_type,
4
+ :codec_time_base, :codec_tag_string, :codec_tag,
5
+ :r_frame_rate, :avg_frame_rate,
6
+ :time_base, :start_time, :duration,
7
+ :nb_frames
8
8
 
9
9
  def initialize(object_attribute_hash)
10
- object_attribute_hash.map do |(k, v)|
11
- writer_m = "#{k}="
12
- send(writer_m, v) if respond_to?(writer_m)
13
- end
10
+ object_attribute_hash.each {|k,v| instance_variable_set("@#{k}",v)}
14
11
  end
15
12
  end
16
13
  end
@@ -1,3 +1,3 @@
1
1
  module Ffprober
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
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.1
4
+ version: 0.2.2
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-14 00:00:00.000000000 Z
11
+ date: 2013-05-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec