From 89aff6e199bb417f1558e977835502baf5bc8f2e Mon Sep 17 00:00:00 2001 From: Bas Stottelaar Date: Sun, 23 Feb 2014 18:59:17 +0100 Subject: [PATCH] Improve logging for Last.FM import --- headphones/lastfm.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/headphones/lastfm.py b/headphones/lastfm.py index 5e0aacaf..e7c89821 100644 --- a/headphones/lastfm.py +++ b/headphones/lastfm.py @@ -95,7 +95,9 @@ def getArtists(): else: username = headphones.LASTFM_USERNAME - + + logger.info("Starting Last.FM artists import with username '%s'" % username) + url = 'http://ws.audioscrobbler.com/2.0/?method=library.getartists&limit=10000&api_key=%s&user=%s' % (api_key, username) data = urllib2.urlopen(url, timeout=20).read() @@ -106,6 +108,7 @@ def getArtists(): return artists = d.getElementsByTagName("artist") + logger.info("Fetched %d artists from Last.FM" % len(artists)) artistlist = [] @@ -125,6 +128,8 @@ def getArtists(): for artistid in artistlist: importer.addArtisttoDB(artistid) + + logger.info("Imported %d new artists from Last.FM" % len(artistid)) def getTagTopArtists(tag, limit=50): myDB = db.DBConnection()