Work on import from discogs. Switching to mysql in local dev

This commit is contained in:
magnolia-fan
2011-09-21 22:59:39 +04:00
parent 5798955b01
commit da003cad12
15 changed files with 110 additions and 13 deletions
+9 -3
View File
@@ -10,12 +10,18 @@ class Discogs
end
def self.process_artist node
Artist.new(
artist = Artist.new(
:name => (node.css('name').first.text),
:pic_url => (node.css('images > image[type="primary"]').first.text unless node.css('images > image[type="primary"]').empty?),
:status => 1
).save
p node.css('name').first.text
)
artist.save
node.css('namevariations > name, aliases > name').each do |v|
ArtistAlias.new(
:artist_id => artist.id,
:name => v.text
).save
end
end
def self.releases