From 311cc557ff5c5c2269f5f691c46274f2d81734f4 Mon Sep 17 00:00:00 2001 From: blueblots <63152708+blueblots@users.noreply.github.com> Date: Sat, 30 Jan 2021 23:38:12 +0000 Subject: [PATCH] Added --keep-going option to cd rip command Implemented the option (`-k`, `--keep-going`) to continue ripping the CD even if one track fails to rip (as @xmixahlx suggested in #128). Requested in #128 Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com> Changed line-lengths/indentation of some code Travis-CI was failing on account of lines being under-indented or too long, this should correct it. Signed-off-by: blueblots <63152708+blueblots@users.noreply.github.com> --- whipper/command/cd.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/whipper/command/cd.py b/whipper/command/cd.py index 853902b..12ee1d2 100644 --- a/whipper/command/cd.py +++ b/whipper/command/cd.py @@ -310,6 +310,11 @@ Log files will log the path to tracks relative to this directory. "{}; 0 means " "infinity.".format(DEFAULT_MAX_RETRIES), default=DEFAULT_MAX_RETRIES) + self.parser.add_argument('-k', '--keep-going', + action='store_true', + help="continue ripping further tracks " + "instead of giving up if a track " + "can't be ripped") def handle_arguments(self): self.options.output_directory = os.path.expanduser( @@ -476,9 +481,14 @@ Log files will log the path to tracks relative to this directory. tries -= 1 logger.critical('giving up on track %d after %d times', number, tries) - raise RuntimeError("track can't be ripped. " - "Rip attempts number is equal to %d", - self.options.max_retries) + if self.options.keep_going: + logger.warning("track %d failed to rip. " + "Continuing to next track", number) + else: + raise RuntimeError("track can't be ripped. " + "Rip attempts number is equal " + "to %d", + self.options.max_retries) if trackResult.testcrc == trackResult.copycrc: logger.info('CRCs match for track %d', number) else: