diff --git a/data/interfaces/default/artist.html b/data/interfaces/default/artist.html index fced33c4..164658a2 100644 --- a/data/interfaces/default/artist.html +++ b/data/interfaces/default/artist.html @@ -109,6 +109,9 @@ <%def name="headIncludes()"> + %if artist['Status'] == 'Loading': + + %endif <%def name="javascriptIncludes()"> @@ -140,4 +143,4 @@ }); }); - \ No newline at end of file + diff --git a/headphones/importer.py b/headphones/importer.py index 740114dd..e127943e 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -68,6 +68,14 @@ def addArtisttoDB(artistid, extrasonly=False): return myDB = db.DBConnection() + + # We need the current minimal info in the database instantly + # so we don't throw a 500 error when we redirect to the artistPage + + controlValueDict = {"ArtistID": artistid} + newValueDict = {"ArtistName": "Artist ID: %s" % (artistid), + "Status": "Loading"} + myDB.upsert("artists", newValueDict, controlValueDict) artist = mb.getArtist(artistid, extrasonly) @@ -309,4 +317,4 @@ def addReleaseById(rid): logger.error("ReleaseGroup does not exist in the database and did not get a valid response from MB. Skipping release.") return else: - logger.info('Release ' + str(rid) + " already exists in the database!") \ No newline at end of file + logger.info('Release ' + str(rid) + " already exists in the database!") diff --git a/headphones/webserve.py b/headphones/webserve.py index bbe6196d..e87f5456 100644 --- a/headphones/webserve.py +++ b/headphones/webserve.py @@ -70,7 +70,6 @@ class WebInterface(object): def addArtist(self, artistid): threading.Thread(target=importer.addArtisttoDB, args=[artistid]).start() - time.sleep(5) threading.Thread(target=lastfm.getSimilar).start() raise cherrypy.HTTPRedirect("artistPage?ArtistID=%s" % artistid) addArtist.exposed = True @@ -495,4 +494,4 @@ class WebInterface(object): lastfm.getSimilar() raise cherrypy.HTTPRedirect("extras") - updateCloud.exposed = True \ No newline at end of file + updateCloud.exposed = True