Merge pull request #410 from whipper-team/bugfix/issue-375-cd-info-no-attribute
Handle missing self.options for whipper cd info
This commit is contained in:
@@ -134,20 +134,23 @@ class _CD(BaseCommand):
|
|||||||
return -1
|
return -1
|
||||||
|
|
||||||
# Change working directory before cdrdao's task
|
# Change working directory before cdrdao's task
|
||||||
if self.options.working_directory is not None:
|
if getattr(self.options, 'working_directory', False):
|
||||||
os.chdir(os.path.expanduser(self.options.working_directory))
|
os.chdir(os.path.expanduser(self.options.working_directory))
|
||||||
out_bpath = self.options.output_directory.decode('utf-8')
|
if hasattr(self.options, 'output_directory'):
|
||||||
# Needed to preserve cdrdao's tocfile
|
out_bpath = self.options.output_directory.decode('utf-8')
|
||||||
out_fpath = self.program.getPath(out_bpath,
|
# Needed to preserve cdrdao's tocfile
|
||||||
self.options.disc_template,
|
out_fpath = self.program.getPath(out_bpath,
|
||||||
self.mbdiscid,
|
self.options.disc_template,
|
||||||
self.program.metadata)
|
self.mbdiscid,
|
||||||
|
self.program.metadata)
|
||||||
|
else:
|
||||||
|
out_fpath = None
|
||||||
# now, read the complete index table, which is slower
|
# now, read the complete index table, which is slower
|
||||||
|
offset = getattr(self.options, 'offset', 0)
|
||||||
self.itable = self.program.getTable(self.runner,
|
self.itable = self.program.getTable(self.runner,
|
||||||
self.ittoc.getCDDBDiscId(),
|
self.ittoc.getCDDBDiscId(),
|
||||||
self.ittoc.getMusicBrainzDiscId(),
|
self.ittoc.getMusicBrainzDiscId(),
|
||||||
self.device, self.options.offset,
|
self.device, offset, out_fpath)
|
||||||
out_fpath)
|
|
||||||
|
|
||||||
assert self.itable.getCDDBDiscId() == self.ittoc.getCDDBDiscId(), \
|
assert self.itable.getCDDBDiscId() == self.ittoc.getCDDBDiscId(), \
|
||||||
"full table's id %s differs from toc id %s" % (
|
"full table's id %s differs from toc id %s" % (
|
||||||
|
|||||||
Reference in New Issue
Block a user