ruby-ogginfo 0.6.12 → 0.6.13

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/History.txt +4 -0
  3. data/lib/ogginfo.rb +26 -1
  4. metadata +3 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8585e7e2229be9e16ac3542d91eee2f948998b25
4
- data.tar.gz: 850e827c22d2ddafaa5c3fb09d32a44650d64ca5
3
+ metadata.gz: 64fe37d30ec71b806565bb145420a15d02cca949
4
+ data.tar.gz: c81047a2cfb57c2682042538efe9b1b046b8d2b2
5
5
  SHA512:
6
- metadata.gz: f949a67d1f3b31f6b2abb31c779bc4c3148ee90a2bbd7d0878a47e63f2e26cfc6e9be8515edfd6edd6faed9216e7c0cd4de96e0faf99df0eabd983a8defe2808
7
- data.tar.gz: 39139a7d9754dc5e6a24ecaf5f93bfd902b6782c0e629d42129c2bfa9710bdf1e99820aa20ac38f1d0831551ac3dfa00e03975411b79cfdaffcbeda05e1f1826
6
+ metadata.gz: d221fde4a1c1019de12112e2b789e8ad7cda57f39470e133f77f9e99f5245d288b64d9ccc7fe579739e0c73a94daf5c992a19ced3cfe0bfc90cb2c70de5e96cf
7
+ data.tar.gz: 08e59d9b7335f6576ebbec421683ea8ff0a32073278c0a6931caa1b58c3ec8d8dfda37ad6295681e0f254ca9dacf783311602ba6b8b24a00c38f0ce5f6feb9c2
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 0.6.13 / 2013-10-25
2
+
3
+ * added OggInfo#picture=(filepath) method to add picture to OggFile with METADATA_BLOCK_PICTURE tag
4
+
1
5
  === 0.6.12 / 2013-09-05
2
6
 
3
7
  * avoid potential race condition on temp file creation
data/lib/ogginfo.rb CHANGED
@@ -25,7 +25,7 @@ end
25
25
  class OggInfoError < StandardError ; end
26
26
 
27
27
  class OggInfo
28
- VERSION = "0.6.12"
28
+ VERSION = "0.6.13"
29
29
  extend Forwardable
30
30
  include Ogg
31
31
 
@@ -78,6 +78,31 @@ class OggInfo
78
78
  def bitrate
79
79
  @bitrate ||= (@filesize * 8).to_f / length()
80
80
  end
81
+
82
+ # Add a picture (.jpg or .png) to the ogg file
83
+ def picture=(filepath)
84
+ ext = File.extname(filepath)
85
+ mime_type = {
86
+ ".jpg" => "image/jpeg",
87
+ ".png" => "image/png"
88
+ }[ext]
89
+ description = "folder#{ext}"
90
+ raw_string =
91
+ [3, # picture type
92
+ mime_type.size,
93
+ mime_type,
94
+ description.size,
95
+ description,
96
+ 0, # width
97
+ 0, # height
98
+ 0, # color depth
99
+ 0, # number of colors used
100
+ File.size(filepath),
101
+ File.binread(filepath)
102
+ ].pack("NNa*Na*NNNNNa*")
103
+
104
+ @tag["METADATA_BLOCK_PICTURE"] = [raw_string].pack("m*").strip
105
+ end
81
106
 
82
107
  # "block version" of ::new()
83
108
  def self.open(*args)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-ogginfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.12
4
+ version: 0.6.13
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Pierronnet
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-05 00:00:00.000000000 Z
12
+ date: 2013-10-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdoc
@@ -104,7 +104,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
104
104
  version: '0'
105
105
  requirements: []
106
106
  rubyforge_project: ruby-ogginfo
107
- rubygems_version: 2.0.6
107
+ rubygems_version: 2.1.5
108
108
  signing_key:
109
109
  specification_version: 4
110
110
  summary: ruby-ogginfo gives you access to low level information on ogg files (bitrate,