Detect and handle CD-R discs (#154)

* Use cdrdao to detect CD-Rs and continue ripping only if the argument --cdr is passed.

* Get and display disc format from MusicBrainz.

* Add info about CD-R detection to logger

* Remove Musicbrainz medium format info

* add cdrdao command to logger

* Fix for PEP8

* Fix line break
This commit is contained in:
gorgobacka
2017-06-06 11:12:00 +02:00
committed by JoeLametta
parent fe4cf1a745
commit 4b3d462b16
4 changed files with 31 additions and 0 deletions

View File

@@ -143,6 +143,13 @@ class _CD(BaseCommand):
"--unknown not passed")
return -1
self.program.result.isCdr = cdrdao.DetectCdr(self.device)
if (self.program.result.isCdr and
not getattr(self.options, 'cdr', False)):
logger.critical("inserted disc seems to be a CD-R, "
"--cdr not passed")
return -1
# FIXME ?????
# Hackish fix for broken commit
offset = 0
@@ -300,6 +307,11 @@ Log files will log the path to tracks relative to this directory.
action="store_true", dest="unknown",
help="whether to continue ripping if "
"the CD is unknown", default=False)
self.parser.add_argument('--cdr',
action="store_true", dest="cdr",
help="whether to continue ripping if "
"the disc is a CD-R",
default=False)
def handle_arguments(self):
self.options.output_directory = os.path.expanduser(