mirror of
https://github.com/rembo10/headphones.git
synced 2026-07-21 16:34:01 +01:00
Add error checking to importer, so we don't mark an artist as being updated if not all albums were added/refreshed
This commit is contained in:
+12
-2
@@ -103,6 +103,9 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
logger.warn('Cannot import Various Artists.')
|
logger.warn('Cannot import Various Artists.')
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# We'll use this to see if we should update the 'LastUpdated' time stamp
|
||||||
|
errors = False
|
||||||
|
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
|
|
||||||
# Delete from blacklist if it's on there
|
# Delete from blacklist if it's on there
|
||||||
@@ -171,6 +174,7 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if not releaselist:
|
if not releaselist:
|
||||||
|
errors = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# This will be used later to build a hybrid release
|
# This will be used later to build a hybrid release
|
||||||
@@ -186,10 +190,12 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
try:
|
try:
|
||||||
releasedict = mb.getRelease(releaseid, include_artist_info=False)
|
releasedict = mb.getRelease(releaseid, include_artist_info=False)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
errors = True
|
||||||
logger.info('Unable to get release information for %s: %s' % (release['id'], e))
|
logger.info('Unable to get release information for %s: %s' % (release['id'], e))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not releasedict:
|
if not releasedict:
|
||||||
|
errors = True
|
||||||
continue
|
continue
|
||||||
|
|
||||||
controlValueDict = {"ReleaseID": release['id']}
|
controlValueDict = {"ReleaseID": release['id']}
|
||||||
@@ -412,14 +418,18 @@ def addArtisttoDB(artistid, extrasonly=False):
|
|||||||
"TotalTracks": totaltracks,
|
"TotalTracks": totaltracks,
|
||||||
"HaveTracks": havetracks}
|
"HaveTracks": havetracks}
|
||||||
|
|
||||||
newValueDict['LastUpdated'] = helpers.now()
|
if not errors:
|
||||||
|
newValueDict['LastUpdated'] = helpers.now()
|
||||||
|
|
||||||
myDB.upsert("artists", newValueDict, controlValueDict)
|
myDB.upsert("artists", newValueDict, controlValueDict)
|
||||||
|
|
||||||
logger.info(u"Seeing if we need album art for: " + artist['artist_name'])
|
logger.info(u"Seeing if we need album art for: " + artist['artist_name'])
|
||||||
cache.getThumb(ArtistID=artistid)
|
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):
|
def addReleaseById(rid):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user