wmainfo-rb 0.3 → 0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +13 -9
  2. data/lib/wmainfo.rb +16 -3
  3. metadata +4 -3
data/README CHANGED
@@ -14,22 +14,26 @@ foo = WmaInfo.new("someVideo.wmv", debug=1)
14
14
 
15
15
  == Public attributes ==
16
16
 
17
- @drm :: '1' if DRM present else 'None'
17
+ @drm :: 'true' if DRM present else 'false'
18
18
  @tags :: dict of strings (id3 like data)
19
19
  @info :: dict of variable types (non-id3 like data)
20
20
  @headerObject :: dict of arrays (name, GUID, size and offset of ASF objects)
21
21
 
22
22
  == Public methods ==
23
23
 
24
- print_objects :: pretty-print header objects
25
- hasdrm :: returns True if file has DRM
26
- hastag('str') :: returns True if @tags['str'] exists
27
- print_tags :: pretty-print @tags dict
28
- hasinfo('str') :: returns True if @info['str'] exists
29
- print_info :: pretty-print @info dict
30
- parse_stream :: parse Asf_Stream_Property_Object
24
+ print_objects :: pretty-print header objects
25
+ hasdrm? :: returns True if file has DRM
26
+ hastag?('str') :: returns True if @tags['str'] exists
27
+ print_tags :: pretty-print @tags dict
28
+ hasinfo?('str') :: returns True if @info['str'] exists
29
+ print_info :: pretty-print @info dict
30
+ parse_stream :: parse Asf_Stream_Property_Object
31
31
  ... which will create another public attribute:
32
- @stream :: dict of variable types (stream properties data)
32
+ @stream :: dict of variable types (stream properties data)
33
33
 
34
34
  For more/different documentation see http://badcomputer.org/unix/code/wmainfo/
35
35
 
36
+ == Thanks/Contributors ==
37
+
38
+ Ilmari Heikkinen sent in a fix for uninitialized '@ext_info'
39
+
@@ -17,6 +17,7 @@
17
17
  # Author:: Darren Kirby (mailto:bulliver@badcomputer.org)
18
18
  # Website:: http://badcomputer.org/unix/code/wmainfo/
19
19
 
20
+ # TODO: Get rid of all the CamelCase
20
21
 
21
22
  # raised when errors occur parsing wma header
22
23
  class WmaInfoError < StandardError
@@ -31,6 +32,7 @@ class WmaInfo
31
32
  @tags = {}
32
33
  @headerObject = {}
33
34
  @info = {}
35
+ @ext_info = {}
34
36
  @file = file
35
37
  @debug = debug
36
38
  parseWmaHeader
@@ -52,7 +54,7 @@ class WmaInfo
52
54
 
53
55
  # returns true if tags["tag"] has a value
54
56
  def hastag?(tag)
55
- @tags["#{tag}"] ? true : false
57
+ @tags[tag] ? true : false
56
58
  end
57
59
 
58
60
  # prettyprint WmaInfo.tags hash
@@ -62,7 +64,7 @@ class WmaInfo
62
64
 
63
65
  # returns true if info["field"] has a value
64
66
  def hasinfo?(field)
65
- @info["#{field}"] ? true : false
67
+ @info[field] ? true : false
66
68
  end
67
69
 
68
70
  # prettyprint WmaInfo.info hash
@@ -88,6 +90,17 @@ class WmaInfo
88
90
  "#{File.basename(@file)} :: Size: #{@size} bytes :: Bitrate: #{@info['bitrate']} kbps :: Duration: #{@info['playtime_seconds']} seconds"
89
91
  end
90
92
 
93
+ #--
94
+ # This cleans up the output when using WmaInfo in irb
95
+ def inspect #:nodoc:
96
+ s = "#<#{self.class}:0x#{(self.object_id*2).to_s(16)} "
97
+ @headerObject.each_pair do |k,v|
98
+ s += "(#{k.upcase} size=#{v[1]} offset=#{v[2]}) " unless k == "ASF_Header_Object"
99
+ end
100
+ s += "\b>"
101
+ end
102
+ #++
103
+
91
104
  private
92
105
  def parseWmaHeader
93
106
  @size = File.size(@file)
@@ -180,7 +193,7 @@ class WmaInfo
180
193
 
181
194
  def parseASFContentEncryptionObject
182
195
  @drm = 1
183
- end
196
+ end
184
197
 
185
198
  def parseASFFilePropertiesObject
186
199
  fileid = readAndIncrementOffset(16)
metadata CHANGED
@@ -1,10 +1,10 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.8.11
2
+ rubygems_version: 0.9.4
3
3
  specification_version: 1
4
4
  name: wmainfo-rb
5
5
  version: !ruby/object:Gem::Version
6
- version: "0.3"
7
- date: 2006-08-05 00:00:00 -07:00
6
+ version: "0.4"
7
+ date: 2007-10-09 00:00:00 -06:00
8
8
  summary: Pure Ruby lib for accessing info/tags from wma/wmv files
9
9
  require_paths:
10
10
  - lib
@@ -25,6 +25,7 @@ required_ruby_version: !ruby/object:Gem::Version::Requirement
25
25
  platform: ruby
26
26
  signing_key:
27
27
  cert_chain:
28
+ post_install_message:
28
29
  authors:
29
30
  - Darren Kirby
30
31
  files: