Skip to content

Commit

Permalink
Merge pull request #410 from whipper-team/bugfix/issue-375-cd-info-no…
Browse files Browse the repository at this point in the history
…-attribute

Handle missing self.options for whipper cd info
  • Loading branch information
JoeLametta authored Oct 26, 2019
2 parents d9b49df + 993dd6c commit da42842
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions whipper/command/cd.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,23 @@ def do(self):
return -1

# 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))
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)
if hasattr(self.options, 'output_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)
else:
out_fpath = None
# now, read the complete index table, which is slower
offset = getattr(self.options, 'offset', 0)
self.itable = self.program.getTable(self.runner,
self.ittoc.getCDDBDiscId(),
self.ittoc.getMusicBrainzDiscId(),
self.device, self.options.offset,
out_fpath)
self.device, offset, out_fpath)

assert self.itable.getCDDBDiscId() == self.ittoc.getCDDBDiscId(), \
"full table's id %s differs from toc id %s" % (
Expand Down

0 comments on commit da42842

Please sign in to comment.