Preserve ToC file generated by cdrdao

Whipper uses cdrdao during its ripping process. With this commit it will now store cdrdao's generated tocfile in the ripping path.
Preserving the tocfile allows users to easily burn ripped discs having a non-compliant cue sheet.

Fixes #214.
This commit is contained in:
JoeLametta
2018-10-26 08:00:00 +00:00
parent 2b286be91c
commit c2af4459ef
3 changed files with 27 additions and 10 deletions

View File

@@ -135,11 +135,21 @@ class _CD(BaseCommand):
"--cdr not passed")
return -1
# Change working directory before cdrdao's task
if self.options.working_directory is not None:
os.chdir(os.path.expanduser(self.options.working_directory))
out_bpath = self.options.output_directory.decode('utf-8')
# Needed to preserve cdrdao's tocfile
out_fpath = self.program.getPath(out_bpath,
self.options.disc_template,
self.mbdiscid,
self.program.metadata)
# now, read the complete index table, which is slower
self.itable = self.program.getTable(self.runner,
self.ittoc.getCDDBDiscId(),
self.ittoc.getMusicBrainzDiscId(),
self.device, self.options.offset)
self.device, self.options.offset,
out_fpath)
assert self.itable.getCDDBDiscId() == self.ittoc.getCDDBDiscId(), \
"full table's id %s differs from toc id %s" % (
@@ -329,9 +339,6 @@ Log files will log the path to tracks relative to this directory.
dirname.encode('utf-8'))
logger.critical(msg)
raise RuntimeError(msg)
else:
sys.stdout.write("output directory %s already exists\n" %
dirname.encode('utf-8'))
else:
print("creating output directory %s" % dirname.encode('utf-8'))
os.makedirs(dirname)