Parsing discogs better

This commit is contained in:
magnolia-fan
2011-11-15 18:41:51 +04:00
parent 1a5e0cb819
commit 4398b1212a
5 changed files with 102 additions and 3 deletions
+5 -2
View File
@@ -144,7 +144,10 @@ class Discogs
if split == 2
break
end
if _.attr('class').match(/^main.*/) and _.css('td')[3].text.scan(/\d/).join('') != '' and _.css('a.mr_toggler').length == 1
if _.attr('class').match(/^main.*/) and _.css('td')[3].text.scan(/\d/).join('') != '' and (
_.css('a.mr_toggler').length == 1 or
_.css('td')[1].text.match(/\(.*?Album.*?\)/).present?
)
albums << {
:uri => (_.attr('class').match(/master/) ? 'master/' : 'release/')+_.attr('id')[1,100],
:title => _.css('h4 > a').first.text,
@@ -152,7 +155,7 @@ class Discogs
}
end
end
albums
ap albums
end
def self.search_for_artist name