Check for total number of tracks before continuing. Prevents ZeroDivisonError's

This commit is contained in:
Bas Stottelaar
2014-08-13 18:31:08 +00:00
parent 9178740c26
commit 8c9b834bc4

View File

@@ -432,9 +432,16 @@ def addArtisttoDB(artistid, extrasonly=False, forcefull=False):
tracks = myDB.action('SELECT * from alltracks WHERE ReleaseID=?', [releaseid]).fetchall()
# This is used to see how many tracks you have from an album - to mark it as downloaded. Default is 80%, can be set in config as ALBUM_COMPLETION_PCT
# This is used to see how many tracks you have from an album - to
# mark it as downloaded. Default is 80%, can be set in config as
# ALBUM_COMPLETION_PCT
total_track_count = len(tracks)
if total_track_count == 0:
logger.warning("Total track count is zero for Release ID " +
"'%s', skipping.", releaseid)
continue
for track in tracks:
controlValueDict = {"TrackID": track['TrackID'],