musicbrainz_automatcher 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/musicbrainz_automatcher.rb +10 -10
- metadata +3 -3
@@ -96,18 +96,18 @@ class MusicbrainzAutomatcher
|
|
96
96
|
protected
|
97
97
|
|
98
98
|
## Perform a block if key isn't already cached.
|
99
|
-
def do_cached(
|
99
|
+
def do_cached(string, &block)
|
100
|
+
key = Digest::SHA1.hexdigest(string)
|
101
|
+
|
100
102
|
# have a look in the cache
|
101
103
|
value = @cache.fetch( key )
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
# Store value in the cache
|
110
|
-
return @cache.write( key, value, :expires_at => Time.parse("18:00"))
|
104
|
+
if value.nil?
|
105
|
+
# Cache MISS : execute the block
|
106
|
+
value = block.call( key )
|
107
|
+
# Store value in the cache
|
108
|
+
@cache.write( key, value, :expires_at => Time.parse("18:00"))
|
109
|
+
end
|
110
|
+
value
|
111
111
|
end
|
112
112
|
|
113
113
|
# Clean up the artist name array
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: musicbrainz_automatcher
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Sinclair
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-
|
12
|
+
date: 2010-08-18 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -101,6 +101,6 @@ rubyforge_project: musicbrainz_automatcher
|
|
101
101
|
rubygems_version: 1.3.5
|
102
102
|
signing_key:
|
103
103
|
specification_version: 3
|
104
|
-
summary:
|
104
|
+
summary: musicbrainz_automatcher matches artists/tracks names to MusicBrainz intelligently
|
105
105
|
test_files: []
|
106
106
|
|