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

@@ -47,6 +47,19 @@ def read_toc(device, fast_toc=False):
return toc
def DetectCdr(device):
"""
Return whether cdrdao detects a CD-R for 'device'.
"""
cmd = [CDRDAO, 'disk-info', '-v1', '--device', device]
logger.debug("executing %r", cmd)
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
if 'CD-R medium : n/a' in p.stdout.read():
return False
else:
return True
def version():
"""
Return cdrdao version as a string.