1
0
Fork 0

Lastfm import task fix

This commit is contained in:
magnolia-fan 2011-09-16 06:02:39 +04:00
parent 6c42b98383
commit e94fae6099
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ class ImportController < ApplicationController
begin
lastfm_artist = lastfm.artist.get_info(name)
unless artist.mbid.nil?
unless artist.mbid.nil? or artist.mbid.empty?
brainz_artist = MusicBrainz::Artist.find(artist.mbid)
else
brainz_artist = MusicBrainz::Artist.find_by_name(name)

View File

@ -3,7 +3,7 @@ namespace :lastfm do
desc 'Import top 1000 artists from last.fm'
task :top => :environment do
ImportController.parseLastfmXML('tmp/data/top1000.xml').each do |artist|
puts artist[:name] + (artist[:mbid].nil? ? '' : ' (' + artist[:mbid] + ')')
puts artist[:name] + (artist[:mbid].empty? ? '' : ' (' + artist[:mbid] + ')')
record = Artist.find_or_create_by_name(artist[:name])
record.mbid = artist[:mbid]
record.save