1
0
Fork 0
oldhaven/lib/tasks/db_artist.rake

23 lines
594 B
Ruby
Raw Normal View History

namespace :db do
namespace :artist do
desc 'Fix broken imports'
task :fix => :environment do
Artist.where(:status => [0, 2]).each do |artist|
artist.albums.each do |album|
album.destroy
end
puts 'Artist:'+artist.name
puts 'MBID: '+artist.mbid unless artist.mbid.nil?
res = ImportController.importArtist(artist.name)
if res == 1
puts 'Status: OK'
elsif res == 2
puts 'Status: FAILED'
elsif res == 3
puts 'Status: SKIP'
end
puts ''
end
end
end
end