diff --git a/headphones/importer.py b/headphones/importer.py index 571360e9..50c7531e 100644 --- a/headphones/importer.py +++ b/headphones/importer.py @@ -103,6 +103,9 @@ def addArtisttoDB(artistid, extrasonly=False): logger.warn('Cannot import Various Artists.') return + # We'll use this to see if we should update the 'LastUpdated' time stamp + errors = False + myDB = db.DBConnection() # Delete from blacklist if it's on there @@ -171,6 +174,7 @@ def addArtisttoDB(artistid, extrasonly=False): continue if not releaselist: + errors = True continue # This will be used later to build a hybrid release @@ -186,10 +190,12 @@ def addArtisttoDB(artistid, extrasonly=False): try: releasedict = mb.getRelease(releaseid, include_artist_info=False) except Exception, e: + errors = True logger.info('Unable to get release information for %s: %s' % (release['id'], e)) continue if not releasedict: + errors = True continue controlValueDict = {"ReleaseID": release['id']} @@ -412,14 +418,18 @@ def addArtisttoDB(artistid, extrasonly=False): "TotalTracks": totaltracks, "HaveTracks": havetracks} - newValueDict['LastUpdated'] = helpers.now() + if not errors: + newValueDict['LastUpdated'] = helpers.now() myDB.upsert("artists", newValueDict, controlValueDict) logger.info(u"Seeing if we need album art for: " + artist['artist_name']) cache.getThumb(ArtistID=artistid) - logger.info(u"Updating complete for: " + artist['artist_name']) + if errors: + logger.info("Finished updating artist: " + artist['artist_name'] + " but with errors, so not marking it as updated in the database") + else: + logger.info(u"Updating complete for: " + artist['artist_name']) def addReleaseById(rid):