def cmd_fix_artist_names(*args): """correct names according to Last.fm""" from ardj.scrobbler import LastFM from ardj.database import Track, commit cli = LastFM().authorize() if cli is None: print "Last.fm authentication failed." return False names = Track.get_artist_names() print "Correcting %u artists." % len(names) for name in names: new_name = cli.get_corrected_name(name) if new_name is not None and new_name != name: logging.info("Correcting artist name \"%s\" to \"%s\"" % (name.encode("utf-8"), new_name.encode("utf-8"))) Track.rename_artist(name, new_name) commit()
def cmd_fix_artist_names(*args): """correct names according to Last.fm""" from ardj.scrobbler import LastFM from ardj.database import Track, commit cli = LastFM().authorize() if cli is None: print "Last.fm authentication failed." return False names = Track.get_artist_names() print "Correcting %u artists." % len(names) for name in names: new_name = cli.get_corrected_name(name) if new_name is not None and new_name != name: logging.info("Correcting artist name \"%s\" to \"%s\"" % (name.encode("utf-8"), new_name.encode("utf-8"))) Track.rename_artist(name, new_name) commit()