pHash 1.1.0 → 1.1.1
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.
- data/lib/phash/audio.rb +4 -4
- data/pHash.gemspec +1 -1
- metadata +3 -3
data/lib/phash/audio.rb
CHANGED
@@ -77,7 +77,7 @@ module Phash
|
|
77
77
|
end
|
78
78
|
|
79
79
|
# Use <tt>audio_data</tt> and <tt>audio_data_hash</tt> to compute hash for file at path, specify max length in seconds to read
|
80
|
-
def audio_hash(path, length =
|
80
|
+
def audio_hash(path, length = nil, sample_rate = nil)
|
81
81
|
sample_rate ||= DEFAULT_SAMPLE_RATE
|
82
82
|
if audio_data = audio_data(path, length, sample_rate)
|
83
83
|
audio_data_hash(audio_data, sample_rate)
|
@@ -116,12 +116,12 @@ module Phash
|
|
116
116
|
attr_reader :length
|
117
117
|
|
118
118
|
# Audio path and optional length in seconds to read
|
119
|
-
def initialize(path, length =
|
120
|
-
@path, @length = path, length
|
119
|
+
def initialize(path, length = nil, sample_rate = nil)
|
120
|
+
@path, @length, @sample_rate = path, length, sample_rate
|
121
121
|
end
|
122
122
|
|
123
123
|
def compute_phash
|
124
|
-
Phash.audio_hash(@path, @length)
|
124
|
+
Phash.audio_hash(@path, @length, @sample_rate)
|
125
125
|
end
|
126
126
|
end
|
127
127
|
end
|
data/pHash.gemspec
CHANGED
metadata
CHANGED