Added non-zero exit, altered logger format strings

Added an exit status of 5 when tracks are skipped
during a rip attempt.

Fixed a TypeError caused by a syntax error in the
format string on line 537 in `whipper/command/cd.py`.

Changed f-string to printf-style format string
on line 493 in `whipper/command/cd.py`.

Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com>
This commit is contained in:
blueblots
2021-02-10 22:59:36 +00:00
committed by JoeLametta
parent ae596df834
commit 9f36d323bb

View File

@@ -192,13 +192,13 @@ class _CD(BaseCommand):
cdio.Device(self.device).get_hwinfo()
self.program.result.metadata = self.program.metadata
self.doCommand()
ret = self.doCommand()
if (self.options.eject == 'success' and self.eject or
self.options.eject == 'always'):
utils.eject_device(self.device)
return None
return ret
def doCommand(self):
pass
@@ -490,7 +490,8 @@ Log files will log the path to tracks relative to this directory.
logger.debug("adding %s to skipped_tracks"
% trackResult.filename)
self.skipped_tracks.append(trackResult.filename)
logger.debug(f"skipped_tracks = {self.skipped_tracks}")
logger.debug("skipped_tracks = %s"
% self.skipped_tracks)
trackResult.skipped = True
logger.debug('trackResult.skipped = True')
else:
@@ -531,9 +532,9 @@ Log files will log the path to tracks relative to this directory.
self.itable.getTrackStart(1), number)
else:
if trackResult.filename in self.skipped_tracks:
logger.debug("track %d (%s) "
logger.debug("track %d (%s)"
"has been skipped; not adding to self.itable"
% number, trackResult.filename)
% (number, trackResult.filename))
else:
self.itable.setFile(number, 1, trackResult.filename,
self.itable.getTrackLength(number),
@@ -581,6 +582,12 @@ Log files will log the path to tracks relative to this directory.
self.program.writeLog(discName, self.logger)
if len(self.skipped_tracks) > 0:
logger.warning('%d tracks have been skipped from this rip attempt'
% len(self.skipped_tracks))
return 5
return None
class CD(BaseCommand):
summary = "handle CDs"