mirror of
https://github.com/rembo10/headphones.git
synced 2026-05-02 09:49:36 +01:00
Improve logging for Last.FM import
This commit is contained in:
@@ -95,7 +95,9 @@ def getArtists():
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
username = headphones.LASTFM_USERNAME
|
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)
|
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()
|
data = urllib2.urlopen(url, timeout=20).read()
|
||||||
|
|
||||||
@@ -106,6 +108,7 @@ def getArtists():
|
|||||||
return
|
return
|
||||||
|
|
||||||
artists = d.getElementsByTagName("artist")
|
artists = d.getElementsByTagName("artist")
|
||||||
|
logger.info("Fetched %d artists from Last.FM" % len(artists))
|
||||||
|
|
||||||
artistlist = []
|
artistlist = []
|
||||||
|
|
||||||
@@ -125,6 +128,8 @@ def getArtists():
|
|||||||
|
|
||||||
for artistid in artistlist:
|
for artistid in artistlist:
|
||||||
importer.addArtisttoDB(artistid)
|
importer.addArtisttoDB(artistid)
|
||||||
|
|
||||||
|
logger.info("Imported %d new artists from Last.FM" % len(artistid))
|
||||||
|
|
||||||
def getTagTopArtists(tag, limit=50):
|
def getTagTopArtists(tag, limit=50):
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
|
|||||||
Reference in New Issue
Block a user