23 lines
594 B
Ruby
23 lines
594 B
Ruby
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 |