Artist wipe, local brainz

This commit is contained in:
magnolia-fan
2011-09-21 00:30:42 +04:00
parent 3cd6c111bd
commit 2536645cb8
24 changed files with 208 additions and 8 deletions
+7
View File
@@ -0,0 +1,7 @@
namespace :artist do
desc 'Empty artist database'
task :wipe => :environment do
Album.destroy_all
ArtistLink.destroy_all
end
end
+2 -2
View File
@@ -5,7 +5,7 @@ namespace :lastfm do
ImportController.parseLastfmXML('tmp/data/top1000.xml').each do |artist|
puts artist[:name] + (artist[:mbid].empty? ? '' : ' (' + artist[:mbid] + ')')
record = Artist.find_or_create_by_name(artist[:name])
record.mbid = artist[:mbid]
# record.mbid = artist[:mbid]
record.save
res = ImportController.importArtist(artist[:name])
if res == 1
@@ -22,7 +22,7 @@ namespace :lastfm do
ImportController.parseLastfmXML('tmp/data/hyped500.xml').each do |artist|
puts artist[:name] + (artist[:mbid].empty? ? '' : ' (' + artist[:mbid] + ')')
record = Artist.find_or_create_by_name(artist[:name])
record.mbid = artist[:mbid]
# record.mbid = artist[:mbid]
record.save
res = ImportController.importArtist(artist[:name])
if res == 1