web_video 1.1.1 → 1.1.2

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.
@@ -60,7 +60,7 @@ module WebVideo
60
60
  metadata[:bitrate] = $1 if ffmpeg_output =~ /\,\s+bitrate\:\s+(.*)$/i
61
61
 
62
62
  ffmpeg_output.scan(/Stream\s+#0.(\d+)(\[.+\])?(\(.+\))?:\s(.*):\s([^,]*),\s(.*)/i).each do |match|
63
- metadata[:streams] << WebVideo::Stream.new(:type => match[4], :codec => match[5], :details => match[5])
63
+ metadata[:streams] << WebVideo::Stream.new(:type => match[3], :codec => match[4], :details => match[5])
64
64
  end
65
65
 
66
66
  return metadata
@@ -1,6 +1,6 @@
1
1
  module WebVideo
2
2
  class Stream
3
- attr_accessor :type, :codec, :details, :resolution
3
+ attr_accessor :type, :codec, :details, :width, :height
4
4
 
5
5
  #
6
6
  # stream = Stream.new :type => 'Video', :codec => 'mpeg4', :details => 'yuv420p, 640x480 [PAR 1:1 DAR 4:3], 30 tbr, 30 tbn, 30 tbc'
@@ -13,7 +13,8 @@ module WebVideo
13
13
  @type = options[:type].to_s.downcase
14
14
  @codec = options[:codec]
15
15
  @details = options[:details]
16
- @resolution = extract_resolution_from_details(@details)
16
+
17
+ extract_resolution_from_details
17
18
  end
18
19
 
19
20
  def video?
@@ -24,20 +25,19 @@ module WebVideo
24
25
  @type == 'audio'
25
26
  end
26
27
 
27
- def width
28
- @resolution ? @resolution[/^\d+/] : nil
29
- end
30
-
31
- def height
32
- @resolution ? @resolution[/\d+$/] : nil
28
+ def resolution
29
+ if width && height
30
+ "#{width}x#{height}"
31
+ end
33
32
  end
34
33
 
35
34
  private
36
- def extract_resolution_from_details(details)
37
- return nil if details.blank?
38
-
39
- result = details[/\s\d+x\d+\s/]
40
- result.blank? ? nil : result.strip
35
+
36
+ def extract_resolution_from_details
37
+ if @details =~ /[\s+\,](\d+)x(\d+)[\s+\,]/
38
+ @width = $1.to_i
39
+ @height = $2.to_i
40
+ end
41
41
  end
42
42
  end
43
43
  end
@@ -1,3 +1,3 @@
1
1
  module WebVideo
2
- VERSION = "1.1.1".freeze
2
+ VERSION = "1.1.2".freeze
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_video
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 1
9
- - 1
10
- version: 1.1.1
9
+ - 2
10
+ version: 1.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Igor Galeta
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-10 00:00:00 +03:00
18
+ date: 2011-06-06 00:00:00 +03:00
19
19
  default_executable:
20
20
  dependencies: []
21
21