wmainfo-rb 0.6 → 0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +7 -0
  2. data/README +3 -5
  3. data/lib/wmainfo.rb +14 -6
  4. metadata +40 -52
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: bac79122f1c07214dd3dcc2b3be6c63d522a7166
4
+ data.tar.gz: 84d48bf1f8127919a483a0bac76694f8b2952a7d
5
+ SHA512:
6
+ metadata.gz: 7e92c16f74e5e9bf56f0837a08727f0096df1ee80631ffe070dc15be0dfbb116810122d216ae42c861b159823ba68038e571d40778fd761e0609cd637f33aeca
7
+ data.tar.gz: 85df3d60a2c323e31cec9b5e15e093cb8a58ed435dc096139bbe6e925f04b0161354bfe9bcfd982b1826aa9624f4615c147376271d3b38dbeb3596342bcdf5e7
data/README CHANGED
@@ -1,6 +1,6 @@
1
1
  :: wmainfo-rb ::
2
2
  Author: Darren Kirby
3
- mailto:bulliver@badcomputer.org
3
+ mailto:bulliver@gmail.com
4
4
  License: Ruby
5
5
 
6
6
  = Quick API docs =
@@ -10,7 +10,7 @@ License: Ruby
10
10
  require 'wmainfo'
11
11
  foo = WmaInfo.new("someSong.wma")
12
12
  ... or ...
13
- foo = WmaInfo.new("someVideo.wmv", :encoding=>"UTF-16LE")
13
+ foo = WmaInfo.new("someVideo.wmv", :encoding=>"UTF-16LE")
14
14
  (default encoding is ASCII)
15
15
  ... or ...
16
16
  foo = WmaInfo.new("someVideo.wmv", :debug=>1)
@@ -34,9 +34,7 @@ hasinfo?('str') :: returns True if @info['str'] exists
34
34
  print_info :: pretty-print @info dict
35
35
  print_stream :: pretty-print @stream dict
36
36
 
37
- For more/different documentation see http://badcomputer.org/unix/code/wmainfo/
38
-
39
- == Thanks/Contributors ==
37
+ == Thanks/Contributors ==
40
38
 
41
39
  Ilmari Heikkinen sent in a fix for uninitialized '@ext_info'.
42
40
  Guillaume Pierronnet sent in a patch which improves character encoding handling.
@@ -14,13 +14,13 @@
14
14
  # to Ruby. All credit for the hard work is owed to Dan...
15
15
  #
16
16
  # License:: Ruby
17
- # Author:: Darren Kirby (mailto:bulliver@badcomputer.org)
18
- # Website:: http://badcomputer.org/unix/code/wmainfo/
17
+ # Author:: Darren Kirby (mailto:bulliver@gmail.com)
18
+ # Website:: https://github.com/moumar/wmainfo-rb
19
19
 
20
20
  # Improved character encoding handling thanks to
21
21
  # Guillaume Pierronnet <guillaume.pierronnet @nospam@ gmail.com>
22
22
 
23
- require 'iconv'
23
+ require 'iconv' if RUBY_VERSION.to_f < 1.9
24
24
 
25
25
  # raised when errors occur parsing wma header
26
26
  class WmaInfoError < StandardError
@@ -39,7 +39,8 @@ class WmaInfo
39
39
  @stream = {}
40
40
  @file = file
41
41
  @debug = opts[:debug]
42
- @ic = Iconv.new(opts[:encoding] || "ASCII", "UTF-16LE")
42
+ @encoding = opts[:encoding] || "ASCII"
43
+ @ic = Iconv.new(@encoding, "UTF-16LE") if RUBY_VERSION.to_f < 1.9
43
44
  parse_wma_header
44
45
  end
45
46
 
@@ -190,7 +191,7 @@ class WmaInfo
190
191
  @tags.delete_if { |k,v| v == "" || v == nil }
191
192
  end
192
193
 
193
- def parse_asf_content_encryption_object
194
+ def parse_asf_content_encryption_object
194
195
  @drm = 1
195
196
  end
196
197
 
@@ -310,7 +311,11 @@ class WmaInfo
310
311
 
311
312
  # UTF16LE -> ASCII
312
313
  def decode_binary_string(data)
313
- @ic.iconv(data).strip
314
+ if RUBY_VERSION.to_f < 1.9
315
+ @ic.iconv(data).strip
316
+ else
317
+ data.to_s.encode(@encoding, "UTF-16LE")
318
+ end
314
319
  end
315
320
 
316
321
  def read_and_increment_offset(size)
@@ -320,6 +325,9 @@ class WmaInfo
320
325
  end
321
326
 
322
327
  def byte_string_to_guid(byteString)
328
+ if RUBY_VERSION[0..2] != "1.8"
329
+ byteString = byteString.bytes.to_a
330
+ end
323
331
  guidString = sprintf("%02X", byteString[3])
324
332
  guidString += sprintf("%02X", byteString[2])
325
333
  guidString += sprintf("%02X", byteString[1])
metadata CHANGED
@@ -1,47 +1,45 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: wmainfo-rb
3
- version: !ruby/object:Gem::Version
4
- version: "0.6"
3
+ version: !ruby/object:Gem::Version
4
+ version: '0.8'
5
5
  platform: ruby
6
- authors:
6
+ authors:
7
7
  - Darren Kirby
8
+ - Guillaume Pierronnet
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
-
12
- date: 2009-06-07 00:00:00 -06:00
13
- default_executable:
12
+ date: 2014-08-29 00:00:00.000000000 Z
14
13
  dependencies: []
15
-
16
14
  description: |
17
15
  :: wmainfo-rb ::
18
- Author: Darren Kirby
19
- mailto:bulliver@badcomputer.org
16
+ Authors: Darren Kirby, Guillaume Pierronnet
17
+ mailto:bulliver@gmail.com
20
18
  License: Ruby
21
-
19
+
22
20
  = Quick API docs =
23
-
21
+
24
22
  == Initializing ==
25
-
23
+
26
24
  require 'wmainfo'
27
25
  foo = WmaInfo.new("someSong.wma")
28
26
  ... or ...
29
- foo = WmaInfo.new("someVideo.wmv", :encoding=>"UTF-16LE")
27
+ foo = WmaInfo.new("someVideo.wmv", :encoding=>"UTF-16LE")
30
28
  (default encoding is ASCII)
31
29
  ... or ...
32
30
  foo = WmaInfo.new("someVideo.wmv", :debug=>1)
33
-
31
+
34
32
  == Public attributes ==
35
-
33
+
36
34
  @drm :: 'true' if DRM present else 'false'
37
35
  @tags :: dict of strings (id3 like data)
38
36
  @info :: dict of variable types (non-id3 like data)
39
37
  @ext_info :: dict of variable types (non-id3 like data) from ASF_Extended_Content_Description_Object
40
38
  @headerObject :: dict of arrays (name, GUID, size and offset of ASF objects)
41
39
  @stream :: dict of variable types (stream properties data)
42
-
40
+
43
41
  == Public methods ==
44
-
42
+
45
43
  print_objects :: pretty-print header objects
46
44
  hasdrm? :: returns True if file has DRM
47
45
  hastag?('str') :: returns True if @tags['str'] exists
@@ -49,51 +47,41 @@ description: |
49
47
  hasinfo?('str') :: returns True if @info['str'] exists
50
48
  print_info :: pretty-print @info dict
51
49
  print_stream :: pretty-print @stream dict
52
-
53
- For more/different documentation see http://badcomputer.org/unix/code/wmainfo/
54
-
55
- == Thanks/Contributors ==
56
-
50
+
51
+ == Thanks/Contributors ==
52
+
57
53
  Ilmari Heikkinen sent in a fix for uninitialized '@ext_info'.
58
54
  Guillaume Pierronnet sent in a patch which improves character encoding handling.
59
-
60
- email: bulliver@badcomputer.org
55
+ email: bulliver@gmail.com
61
56
  executables: []
62
-
63
57
  extensions: []
64
-
65
- extra_rdoc_files:
58
+ extra_rdoc_files:
66
59
  - README
67
- files:
60
+ files:
68
61
  - README
69
62
  - lib/wmainfo.rb
70
- has_rdoc: true
71
- homepage: http://badcomputer.org/unix/code/wmainfo/
72
- licenses: []
73
-
63
+ homepage: https://github.com/moumar/wmainfo-rb
64
+ licenses:
65
+ - Ruby
66
+ metadata: {}
74
67
  post_install_message:
75
68
  rdoc_options: []
76
-
77
- require_paths:
69
+ require_paths:
78
70
  - lib
79
- required_ruby_version: !ruby/object:Gem::Requirement
80
- requirements:
81
- - - ">="
82
- - !ruby/object:Gem::Version
83
- version: "0"
84
- version:
85
- required_rubygems_version: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: "0"
90
- version:
71
+ required_ruby_version: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - '>='
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
91
81
  requirements: []
92
-
93
- rubyforge_project: wmainfo-rb
94
- rubygems_version: 1.3.3
82
+ rubyforge_project:
83
+ rubygems_version: 2.0.14
95
84
  signing_key:
96
- specification_version: 3
85
+ specification_version: 4
97
86
  summary: Pure Ruby lib for accessing info/tags from wma/wmv files
98
87
  test_files: []
99
-