Fixes Issue 811 by detecting and failing early if getHybridRelease gets an empty fullreleaselist passed into it.

This commit is contained in:
Patrick Speiser
2012-09-03 23:23:57 +02:00
parent 1efdd64978
commit fa171deca1

View File

@@ -251,7 +251,13 @@ def addArtisttoDB(artistid, extrasonly=False):
myDB.upsert("alltracks", newValueDict, controlValueDict)
# Basically just do the same thing again for the hybrid release
hybridrelease = getHybridRelease(fullreleaselist)
# This may end up being called with an empty fullreleaselist
try:
hybridrelease = getHybridRelease(fullreleaselist)
except Exception, e:
errors = True
logger.warn('Unable to get hybrid release information for %s: %s' % (rg['title'],e))
continue
# Use the ReleaseGroupID as the ReleaseID for the hybrid release to differentiate it
# We can then use the condition WHERE ReleaseID == ReleaseGroupID to select it
@@ -584,6 +590,8 @@ def getHybridRelease(fullreleaselist):
"""
Returns a dictionary of best group of tracks from the list of releases & earliest release date
"""
if len(fullreleaselist) == 0:
raise Exception("getHybridRelease was called with an empty fullreleaselist")
sortable_release_list = []
for release in fullreleaselist: