ruby-ogginfo 0.6.11 → 0.6.12

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 8585e7e2229be9e16ac3542d91eee2f948998b25
4
+ data.tar.gz: 850e827c22d2ddafaa5c3fb09d32a44650d64ca5
5
+ SHA512:
6
+ metadata.gz: f949a67d1f3b31f6b2abb31c779bc4c3148ee90a2bbd7d0878a47e63f2e26cfc6e9be8515edfd6edd6faed9216e7c0cd4de96e0faf99df0eabd983a8defe2808
7
+ data.tar.gz: 39139a7d9754dc5e6a24ecaf5f93bfd902b6782c0e629d42129c2bfa9710bdf1e99820aa20ac38f1d0831551ac3dfa00e03975411b79cfdaffcbeda05e1f1826
@@ -1,3 +1,8 @@
1
+ === 0.6.12 / 2013-09-05
2
+
3
+ * avoid potential race condition on temp file creation
4
+ * remove warnings on unused variables
5
+
1
6
  === 0.6.11 / 2012-07-16
2
7
 
3
8
  * more robust compute_length() method (works on broken OGGs)
data/lib/ogg.rb CHANGED
@@ -123,7 +123,6 @@ if __FILE__ == $0
123
123
  info = Ogg.read_headers(input)
124
124
  pp info
125
125
  vendor = info[:tag_vendor]
126
- tag = info[:tag]
127
126
  end
128
127
 
129
128
  File.open(infile,"r") do | input |
@@ -15,22 +15,22 @@ module Ogg::Codecs
15
15
  end
16
16
 
17
17
  def replace_tags(reader, writer, new_tags, vendor)
18
- tag_packet = reader.read_packets(1)
18
+ _ = reader.read_packets(1) # tag_packet
19
19
  writer.write_packets(0, pack_comments(new_tags, vendor))
20
20
  end
21
21
 
22
22
  def extract_info(info_packet)
23
- speex_string,
24
- speex_version,
25
- speex_version_id,
26
- header_size,
23
+ _, #speex_string,
24
+ _, #speex_version,
25
+ _, #speex_version_id,
26
+ _, #header_size,
27
27
  samplerate,
28
- mode,
29
- mode_bitstream_version,
28
+ _, #mode,
29
+ _, #mode_bitstream_version,
30
30
  channels,
31
31
  nominal_bitrate,
32
- framesize,
33
- vbr = info_packet.unpack("A8A20VVVVVVVVV")
32
+ #framesize, vbr
33
+ _, _ = info_packet.unpack("A8A20VVVVVVVVV")
34
34
  #not sure how to make sense of the bitrate info,picard doesn't show it either...
35
35
 
36
36
  return { :channels => channels, :samplerate => samplerate, :nominal_bitrate => nominal_bitrate }
@@ -9,7 +9,7 @@ module Ogg::Codecs
9
9
 
10
10
  #consume header and tag pages, return array of two hashes, info and tags
11
11
  def decode_headers(reader)
12
- init_pkt, tag_pkt, setup_pkt = reader.read_packets(3)
12
+ init_pkt, tag_pkt, _ = reader.read_packets(3) # init_pkt, tag_pkt, setup_pkt
13
13
  info = extract_info(init_pkt)
14
14
  info[:tag], info[:tag_vendor] = unpack_comments(tag_pkt, "\003vorbis")
15
15
  info
@@ -18,13 +18,13 @@ module Ogg::Codecs
18
18
  # consume pages with old tags/setup packets and rewrite newtags,setup packets
19
19
  # return the number of pages written
20
20
  def replace_tags(reader, writer, new_tags, vendor)
21
- tag_pkt, setup_pkt = reader.read_packets(2)
21
+ _, setup_pkt = reader.read_packets(2) # tag_pkt, setup_pkt
22
22
  writer.write_packets(0, pack_comments(new_tags, vendor, "\003vorbis"), setup_pkt)
23
23
  end
24
24
 
25
25
  def extract_info(packet)
26
- vorbis_string,
27
- vorbis_version,
26
+ _, #vorbis_string,
27
+ _, # vorbis_version,
28
28
  channels,
29
29
  samplerate,
30
30
  upper_bitrate,
@@ -12,7 +12,7 @@ module Ogg
12
12
  chunk = io.read(27)
13
13
 
14
14
  capture_pattern,
15
- version,
15
+ _, # version
16
16
  header,
17
17
  granule_pos,
18
18
  bitstream_serial_no,
@@ -5,7 +5,7 @@
5
5
  # License: ruby
6
6
 
7
7
  require 'forwardable'
8
- require "tmpdir"
8
+ require "tempfile"
9
9
  require File.join(File.dirname(__FILE__), 'ogg.rb')
10
10
 
11
11
  class Hash
@@ -25,7 +25,7 @@ end
25
25
  class OggInfoError < StandardError ; end
26
26
 
27
27
  class OggInfo
28
- VERSION = "0.6.11"
28
+ VERSION = "0.6.12"
29
29
  extend Forwardable
30
30
  include Ogg
31
31
 
@@ -43,7 +43,6 @@ class OggInfo
43
43
  @filename = filename
44
44
  @length = nil
45
45
  @bitrate = nil
46
- filesize = File.size(@filename)
47
46
  File.open(@filename, 'rb') do |file|
48
47
  begin
49
48
  info = read_headers(file)
@@ -99,14 +98,15 @@ class OggInfo
99
98
  # commits any tags to file
100
99
  def close
101
100
  if tag != @original_tag
102
- path = File.join(Dir.tmpdir, "ruby-ogginfo_#{$$}.ogg")
103
- tempfile = File.new(path, "wb")
104
-
105
- File.open(@filename, "rb") do | input |
106
- replace_tags(input, tempfile, tag)
101
+ Tempfile.open(["ruby-ogginfo", ".ogg"]) do |tempfile|
102
+ tempfile.close
103
+ tempfile = File.new(tempfile.path, "wb")
104
+ File.open(@filename, "rb") do | input |
105
+ replace_tags(input, tempfile, tag)
106
+ end
107
+ tempfile.close
108
+ FileUtils.cp(tempfile.path, @filename)
107
109
  end
108
- tempfile.close
109
- FileUtils.mv(path, @filename)
110
110
  end
111
111
  end
112
112
 
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ogginfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.11
5
- prerelease:
4
+ version: 0.6.12
6
5
  platform: ruby
7
6
  authors:
8
7
  - Guillaume Pierronnet
@@ -10,46 +9,54 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-07-16 00:00:00.000000000Z
12
+ date: 2013-09-05 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rdoc
17
- requirement: &79555720 !ruby/object:Gem::Requirement
18
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
22
20
  version: '3.10'
23
21
  type: :development
24
22
  prerelease: false
25
- version_requirements: *79555720
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: '3.10'
26
28
  - !ruby/object:Gem::Dependency
27
29
  name: rcov
28
- requirement: &79545490 !ruby/object:Gem::Requirement
29
- none: false
30
+ requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
32
  - - ~>
32
33
  - !ruby/object:Gem::Version
33
34
  version: '0.9'
34
35
  type: :development
35
36
  prerelease: false
36
- version_requirements: *79545490
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ~>
40
+ - !ruby/object:Gem::Version
41
+ version: '0.9'
37
42
  - !ruby/object:Gem::Dependency
38
43
  name: hoe
39
- requirement: &79543440 !ruby/object:Gem::Requirement
40
- none: false
44
+ requirement: !ruby/object:Gem::Requirement
41
45
  requirements:
42
46
  - - ~>
43
47
  - !ruby/object:Gem::Version
44
- version: '3.0'
48
+ version: '3.5'
45
49
  type: :development
46
50
  prerelease: false
47
- version_requirements: *79543440
48
- description: ! 'ruby-ogginfo gives you access to low level information on ogg files
49
-
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - ~>
54
+ - !ruby/object:Gem::Version
55
+ version: '3.5'
56
+ description: |-
57
+ ruby-ogginfo gives you access to low level information on ogg files
50
58
  (bitrate, length, samplerate, encoder, etc... ), as well as tag.
51
-
52
- It is written in pure ruby.'
59
+ It is written in pure ruby.
53
60
  email:
54
61
  - guillaume.pierronnet@gmail.com
55
62
  - grant@lastweekend.com.au
@@ -78,6 +85,7 @@ files:
78
85
  - .gemtest
79
86
  homepage: http://ruby-ogginfo.rubyforge.org/
80
87
  licenses: []
88
+ metadata: {}
81
89
  post_install_message:
82
90
  rdoc_options:
83
91
  - --main
@@ -85,24 +93,22 @@ rdoc_options:
85
93
  require_paths:
86
94
  - lib
87
95
  required_ruby_version: !ruby/object:Gem::Requirement
88
- none: false
89
96
  requirements:
90
- - - ! '>='
97
+ - - '>='
91
98
  - !ruby/object:Gem::Version
92
99
  version: '0'
93
100
  required_rubygems_version: !ruby/object:Gem::Requirement
94
- none: false
95
101
  requirements:
96
- - - ! '>='
102
+ - - '>='
97
103
  - !ruby/object:Gem::Version
98
104
  version: '0'
99
105
  requirements: []
100
106
  rubyforge_project: ruby-ogginfo
101
- rubygems_version: 1.8.17
107
+ rubygems_version: 2.0.6
102
108
  signing_key:
103
- specification_version: 3
109
+ specification_version: 4
104
110
  summary: ruby-ogginfo gives you access to low level information on ogg files (bitrate,
105
111
  length, samplerate, encoder, etc..
106
112
  test_files:
107
- - test/test_ruby-spxinfo.rb
108
113
  - test/test_ruby-ogginfo.rb
114
+ - test/test_ruby-spxinfo.rb