Better error handling in the post-processor

This commit is contained in:
Remy
2011-07-29 11:39:16 -07:00
parent 511b59bba8
commit 611fae1aa5
2 changed files with 9 additions and 5 deletions

View File

@@ -132,11 +132,11 @@ def artistlist_to_mbids(artistlist):
myDB.upsert("artists", newValueDict, controlValueDict)
# Update the cloud:
logger.info('Updating the cloud')
logger.info('Updating artist information from Last.fm')
try:
lastfm.getSimilar()
except Exception, e:
logger.warn('Updating the cloud failed: %s' % e)
logger.warn('Failed to update arist information from Last.fm: %s' % e)
def addArtisttoDB(artistid, extrasonly=False):

View File

@@ -135,7 +135,7 @@ def cleanupFiles(albumpath):
os.remove(os.path.join(r, files))
def moveFiles(albumpath, release, tracks):
try:
year = release['ReleaseDate'][:4]
except TypeError:
@@ -187,7 +187,7 @@ def correctMetadata(albumid, release, downloaded_track_list):
item.write()
def renameFiles(albumpath, downloaded_track_list, release):
logger.info('Renaming files')
try:
year = release['ReleaseDate'][:4]
except TypeError:
@@ -214,7 +214,11 @@ def renameFiles(albumpath, downloaded_track_list, release):
new_file = os.path.join(albumpath, new_file_name)
shutil.move(downloaded_track, new_file)
try:
shutil.move(downloaded_track, new_file)
except Exception, e:
logger.error('Error renaming file: %s. Error: %s' % (downloaded_track, e))
continue
def updateHave(albumpath):