spot 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/spot.rb +5 -4
  2. data/spot.gemspec +1 -1
  3. metadata +2 -34
data/lib/spot.rb CHANGED
@@ -91,8 +91,9 @@ class Spot
91
91
  end
92
92
 
93
93
  def result
94
- @prime ? results.map do |r|
95
-
94
+ @prime ? results.sort_by do |res|
95
+ res.popularity
96
+ end.reverse[0..4].map do |r|
96
97
  song, artist = type_of(r)
97
98
 
98
99
  match = "#{song} #{artist}".split(" ")
@@ -116,7 +117,7 @@ class Spot
116
117
 
117
118
  [res - r.popularity/@config[:popularity], r]
118
119
  end.reject do |distance, value|
119
- exclude?(value.to_s)
120
+ exclude?(value.to_s) or not value.valid?
120
121
  end.sort_by do |distance, _|
121
122
  distance
122
123
  end.map(&:last).first : results.first
@@ -183,7 +184,7 @@ class Spot
183
184
 
184
185
  @cache[@type] = []; content[@methods[@type][:selector].to_s].each do |item|
185
186
  item = @methods[@type][:class].new(item.merge(@options))
186
- @cache[@type] << item if item.valid?
187
+ @cache[@type] << item if item.valid? or @prime
187
188
  end
188
189
  @cache[@type]
189
190
  end
data/spot.gemspec CHANGED
@@ -3,7 +3,7 @@ $:.push File.expand_path("../lib", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "spot"
6
- s.version = "0.1.2"
6
+ s.version = "0.1.3"
7
7
  s.platform = Gem::Platform::RUBY
8
8
  s.authors = ["Linus Oleander"]
9
9
  s.email = ["linus@oleander.nu"]
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
5
4
  prerelease:
6
- segments:
7
- - 0
8
- - 1
9
- - 2
10
- version: 0.1.2
5
+ version: 0.1.3
11
6
  platform: ruby
12
7
  authors:
13
8
  - Linus Oleander
@@ -26,9 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
24
  version: "0"
33
25
  type: :runtime
34
26
  version_requirements: *id001
@@ -40,9 +32,6 @@ dependencies:
40
32
  requirements:
41
33
  - - ">="
42
34
  - !ruby/object:Gem::Version
43
- hash: 3
44
- segments:
45
- - 0
46
35
  version: "0"
47
36
  type: :runtime
48
37
  version_requirements: *id002
@@ -54,9 +43,6 @@ dependencies:
54
43
  requirements:
55
44
  - - ">="
56
45
  - !ruby/object:Gem::Version
57
- hash: 3
58
- segments:
59
- - 0
60
46
  version: "0"
61
47
  type: :runtime
62
48
  version_requirements: *id003
@@ -68,9 +54,6 @@ dependencies:
68
54
  requirements:
69
55
  - - ">="
70
56
  - !ruby/object:Gem::Version
71
- hash: 3
72
- segments:
73
- - 0
74
57
  version: "0"
75
58
  type: :runtime
76
59
  version_requirements: *id004
@@ -82,9 +65,6 @@ dependencies:
82
65
  requirements:
83
66
  - - ">="
84
67
  - !ruby/object:Gem::Version
85
- hash: 3
86
- segments:
87
- - 0
88
68
  version: "0"
89
69
  type: :runtime
90
70
  version_requirements: *id005
@@ -96,9 +76,6 @@ dependencies:
96
76
  requirements:
97
77
  - - ">="
98
78
  - !ruby/object:Gem::Version
99
- hash: 3
100
- segments:
101
- - 0
102
79
  version: "0"
103
80
  type: :development
104
81
  version_requirements: *id006
@@ -110,9 +87,6 @@ dependencies:
110
87
  requirements:
111
88
  - - ">="
112
89
  - !ruby/object:Gem::Version
113
- hash: 3
114
- segments:
115
- - 0
116
90
  version: "0"
117
91
  type: :development
118
92
  version_requirements: *id007
@@ -162,23 +136,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
162
136
  requirements:
163
137
  - - ">="
164
138
  - !ruby/object:Gem::Version
165
- hash: 3
166
- segments:
167
- - 0
168
139
  version: "0"
169
140
  required_rubygems_version: !ruby/object:Gem::Requirement
170
141
  none: false
171
142
  requirements:
172
143
  - - ">="
173
144
  - !ruby/object:Gem::Version
174
- hash: 3
175
- segments:
176
- - 0
177
145
  version: "0"
178
146
  requirements: []
179
147
 
180
148
  rubyforge_project: spot
181
- rubygems_version: 1.5.0
149
+ rubygems_version: 1.6.2
182
150
  signing_key:
183
151
  specification_version: 3
184
152
  summary: A Ruby implementation of the Spotify Meta API