From 1f7fa42e600744e62f4819063f1d7d5a739754f3 Mon Sep 17 00:00:00 2001 From: Johannes Dewender Date: Mon, 6 Feb 2012 01:24:57 +0100 Subject: [PATCH] multi-disc check ONLY on track count mismatch, re #1 When the number of tracks reported on the disc and the number of tracks given on the release match, we do not need to check the list of discIds. This just means we have multiple discIds for a single disc. There is only a problem when there is another "real" disc, but then the track counts would not match. --- isrcsubmit.py | 78 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 30 deletions(-) diff --git a/isrcsubmit.py b/isrcsubmit.py index 04722a2..7edacc3 100755 --- a/isrcsubmit.py +++ b/isrcsubmit.py @@ -208,44 +208,62 @@ def printError(*args): tracks = release.getTracks() releaseTrackCount = len(tracks) discs = release.getDiscs() +# discCount is actually the count of DiscIDs +# there can be multiple DiscIDs for a single disc discCount = len(discs) print 'Artist:\t\t', release.getArtist().getName() print 'Release:\t', release.getTitle() if releaseTrackCount != discTrackCount: + # a track count mismatch due to: + # a) multiple discs in the release + # b) multiple DiscIDs for a single disc + # c) a)+b) + # d) unknown (see CRITICAL below) print "Tracks in Release:", releaseTrackCount - -if discCount > 1: - # Handling of multiple discs in the release: - # We can only get the overall Release from MB - # and not the Medium itself. - # This changed with NGS. Before there was one release per disc. - print - print "WARNING: Multi-disc-release given by webservice." - print "See '" + scriptname, "-h' for help" - print "Discs in Release: ", discCount - for i in range(discCount): - print "\t", discs[i].getId(), - if discs[i].getId() == discId: - discNumber = i + 1 - print "[THIS DISC]" + if discCount > 1: + # Handling of multiple discs in the release: + # We can only get the overall Release from MB + # and not the Medium itself. + # This changed with NGS. Before there was one release per disc. + print + print "WARNING: Multi-disc-release given by webservice." + print "See '" + scriptname, "-h' for help" + print "Discs in Release: ", discCount + for i in range(discCount): + print "\t", discs[i].getId(), + if discs[i].getId() == discId: + discNumber = i + 1 + print "[THIS DISC]" + else: + print + print + print "This is disc", discNumber, "of", discCount + if discNumber == 1: + # the first disc never needs an offset + trackOffset = 0 + print "Guessing track offset as", trackOffset + elif discNumber == discCount: + # It is easy to guess the offset when this is the last disc, + # because we have no unknown track counts after this. + trackOffset = releaseTrackCount - discTrackCount + print "Guessing track offset as", trackOffset else: - print - print - print "This is disc", discNumber, "of", discCount - if discNumber == 1: - # the first disc never needs an offset - trackOffset = 0 - print "Guessing track offset as", trackOffset - elif discNumber == discCount: - # It is easy to guess the offset when this is the last disc, - # because we have no unknown track counts after this. - trackOffset = releaseTrackCount - discTrackCount - print "Guessing track offset as", trackOffset + # for "middle" discs we have unknown track numbers + # before and after -> the user has to tell us an offset to use + trackOffset = askForOffset() else: - # for "middle" discs we have unknown track numbers - # before and after -> the user has to tell us an offset to use - trackOffset = askForOffset() + # This is actually a weird case + # Having only 1 disc, but not matching trackCounts + # Possibly some data/video track, + # but these should be suppressed on both ends the same + print "CRITICAL: track count mismatch!" + print "CRITICAL: There are", discTrackCount, "tracks on the disc," + print "CRITICAL: but", releaseTrackCount, + print "tracks on a SINGLE-disc-release." + print "CRITICAL: This is not supposed to happen." + sys.exit(-1) else: + # the track count matches trackOffset = 0 # getting the ISRCs with icedax