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.
- checksums.yaml +4 -4
- data/History.txt +4 -0
- data/lib/ogginfo.rb +26 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64fe37d30ec71b806565bb145420a15d02cca949
|
4
|
+
data.tar.gz: c81047a2cfb57c2682042538efe9b1b046b8d2b2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d221fde4a1c1019de12112e2b789e8ad7cda57f39470e133f77f9e99f5245d288b64d9ccc7fe579739e0c73a94daf5c992a19ced3cfe0bfc90cb2c70de5e96cf
|
7
|
+
data.tar.gz: 08e59d9b7335f6576ebbec421683ea8ff0a32073278c0a6931caa1b58c3ec8d8dfda37ad6295681e0f254ca9dacf783311602ba6b8b24a00c38f0ce5f6feb9c2
|
data/History.txt
CHANGED
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.
|
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.
|
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-
|
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.
|
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,
|