This commit is contained in:
Gregory Eremin
2011-09-22 14:37:53 +04:00
parent dbdff13cd0
commit 3ea944fbb0
23 changed files with 206 additions and 6 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