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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user