diff --git a/headphones/importer.py b/headphones/importer.py index 0b3d77a8..041e7acb 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -102,13 +102,7 @@ def artistlist_to_mbids(artistlist, forced=False): myDB.action('DELETE from newartists WHERE ArtistName=?', [artist]) # Update the similar artist tag cloud: - # TODO: Fix last.fm api - # logger.info('Updating artist information from Last.fm') - - # try: - # lastfm.getSimilar() - # except Exception as e: - # logger.warn('Failed to update artist information from Last.fm: %s' % e) + lastfm.getSimilar() def addArtistIDListToDB(artistidlist): diff --git a/headphones/lastfm.py b/headphones/lastfm.py index 4e87219f..dc454777 100644 --- a/headphones/lastfm.py +++ b/headphones/lastfm.py @@ -62,6 +62,13 @@ def request_lastfm(method, **kwargs): def getSimilar(): + if not headphones.CONFIG.LASTFM_APIKEY: + logger.info( + 'To update the Similar Artists cloud tag, create a Last.fm application api key ' + 'and add it under the Advanced config tab' + ) + return + myDB = db.DBConnection() results = myDB.select("SELECT ArtistID from artists ORDER BY HaveTracks DESC LIMIT 10") diff --git a/headphones/librarysync.py b/headphones/librarysync.py index 86715514..e369fedd 100644 --- a/headphones/librarysync.py +++ b/headphones/librarysync.py @@ -442,9 +442,8 @@ def libraryScan(dir=None, append=False, ArtistID=None, ArtistName=None, # if not append: # update_album_status() - # TODO: Fix last.fm api calls - #if not append and not artistScan: - #lastfm.getSimilar() + if not append and not artistScan: + lastfm.getSimilar() if ArtistName: logger.info('Scanning complete for artist: %s', ArtistName)