Tuned last.fm autocomplete to do what i need (:
This commit is contained in:
parent
c9ea9c6a27
commit
aa5d5a51c6
|
@ -55,7 +55,7 @@ class ArtistController < ApplicationController
|
||||||
end
|
end
|
||||||
render :json => {
|
render :json => {
|
||||||
:query => params[:query],
|
:query => params[:query],
|
||||||
:suggestions => suggestions
|
:suggestions => suggestions.take(10)
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ class ArtistController < ApplicationController
|
||||||
return nil if query.nil? or query.strip.empty?
|
return nil if query.nil? or query.strip.empty?
|
||||||
json = ActiveSupport::JSON.decode(open(
|
json = ActiveSupport::JSON.decode(open(
|
||||||
'http://www.last.fm/search/autocomplete' <<
|
'http://www.last.fm/search/autocomplete' <<
|
||||||
'?q=' << URI.escape(query)
|
'?rows=30&q=' << URI.escape(query)
|
||||||
).read)
|
).read)
|
||||||
return json.empty? ? nil : json
|
return json.empty? ? nil : json
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue