Fixing tests
This commit is contained in:
@@ -39,14 +39,13 @@ module MusicBrainz
|
||||
end
|
||||
|
||||
def search(name)
|
||||
artists = load({
|
||||
load({
|
||||
:parser => :artist_search
|
||||
}, {
|
||||
:resource => :artist,
|
||||
:query => CGI.escape(name).gsub(/\!/, '\!') + '~',
|
||||
:limit => 50
|
||||
:query => "artist:" << CGI.escape(name).gsub(/\!/, '\!'),
|
||||
:limit => 10
|
||||
})
|
||||
artists.sort{ |a, b| b[:weight] <=> a[:weight] }.take(10)
|
||||
end
|
||||
|
||||
def discography(mbid)
|
||||
|
||||
@@ -21,19 +21,17 @@ module MusicBrainz
|
||||
end
|
||||
|
||||
def search(xml)
|
||||
artists = []
|
||||
xml.css("artist-list > artist").each do |a|
|
||||
artists << {
|
||||
xml.css("artist-list > artist").map do |a|
|
||||
{
|
||||
:name => a.first_element_child.text.gsub(/[`’]/, "'"),
|
||||
:sort_name => safe_get_value(a, "sort-name").gsub(/[`’]/, "'"),
|
||||
:score => (safe_get_attr(a, nil, "score") .to_i rescue 0),
|
||||
:score => (safe_get_attr(a, nil, "score").to_i rescue 0),
|
||||
:desc => safe_get_value(a, "disambiguation"),
|
||||
:type => safe_get_attr(a, nil, "type"),
|
||||
:mbid => safe_get_attr(a, nil, "id"),
|
||||
:aliases => a.css("alias-list > alias").map { |item| item.text }
|
||||
}
|
||||
end
|
||||
artists
|
||||
end
|
||||
|
||||
def release_groups(xml)
|
||||
|
||||
Reference in New Issue
Block a user