1
0
Fork 0

Fix AC/DC, Panic At The Disco bugs

This commit is contained in:
magnolia-fan 2011-11-24 02:12:15 +04:00
parent 83dd697fb9
commit 3205af0be6
3 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ class ArtistController < ApplicationController
if results.empty? if results.empty?
return render json: { status: 'not_found' } return render json: { status: 'not_found' }
end end
best_match = results[0][:name] best_match = results[0][:sort_name]
if best_match != artist_name and similar_names(artist_name, best_match) if best_match != artist_name and similar_names(artist_name, best_match)
return render json: { status: 'corrected', correct_name: best_match } return render json: { status: 'corrected', correct_name: best_match }
elsif best_match == artist_name elsif best_match == artist_name

View File

@ -17,5 +17,5 @@ Beathaven::Application.routes.draw do
match 'settings' => 'user#settings' match 'settings' => 'user#settings'
match 'artist/autocomplete' => 'last_fm#autocomplete' match 'artist/autocomplete' => 'last_fm#autocomplete'
match 'artist/(:name)/' => 'artist#data', :constraints => { :name => /[^\/]*/ } match 'artist/(:name)' => 'artist#data', :constraints => { :name => /.*/ }
end end

View File

@ -26,7 +26,7 @@ private
response = nil response = nil
5.times do 5.times do
begin begin
response = open(url, "User-Agent" => USER_AGENT) response = open(URI.encode(url), "User-Agent" => USER_AGENT)
@@last_query_time = Time.now.to_f @@last_query_time = Time.now.to_f
rescue => e rescue => e
return nil if e.io.status[0].to_i == 404 return nil if e.io.status[0].to_i == 404