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>
This commit is contained in:
blueblots
2021-01-30 23:38:12 +00:00
committed by JoeLametta
parent 87f3d00ee3
commit 311cc557ff

View File

@@ -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: