diff --git a/whipper/command/cd.py b/whipper/command/cd.py index 7060f869..588afd5f 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -410,13 +410,12 @@ def _ripIfNotRipped(number): if not os.path.exists(path): logger.debug('path %r does not exist, ripping...', path) - tries = 0 # we reset durations for test and copy here trackResult.testduration = 0.0 trackResult.copyduration = 0.0 extra = "" - while tries < MAX_TRIES: - tries += 1 + tries = 1 + while tries <= MAX_TRIES: if tries > 1: extra = " (try %d)" % tries logger.info('ripping track %d of %d%s: %s', @@ -440,8 +439,10 @@ def _ripIfNotRipped(number): # FIXME: catching too general exception (Exception) except Exception as e: logger.debug('got exception %r on try %d', e, tries) + tries += 1 - if tries == MAX_TRIES: + if tries > MAX_TRIES: + tries -= 1 logger.critical('giving up on track %d after %d times', number, tries) raise RuntimeError(