--- ./SOURCECODE/whipper/morituri/./command/cd.py 2017-01-27 16:46:15.422134115 -0800 +++ ./command/cd.py 2017-02-06 17:34:36.000000000 -0800 @@ -336,19 +336,24 @@ ### write disc files disambiguate = False + printedOutDirMessage=False + while True: discName = self.program.getPath(self.program.outdir, self.options.disc_template, self.mbdiscid, 0, - profile=profile, disambiguate=disambiguate) + profile=profile, disambiguate=disambiguate, forDisk=True) dirname = os.path.dirname(discName) if os.path.exists(dirname): - sys.stdout.write("Output directory %s already exists\n" % - dirname.encode('utf-8')) - logs = glob.glob(os.path.join(dirname, '*.log')) + if not printedOutDirMessage: + sys.stdout.write("Output directory %s already exists\n" % + dirname.encode('utf-8')) + printedOutDirMessage = True +# logs = glob.glob(os.path.join(dirname, '*.log')) + logs = glob.glob(discName + '.log') if logs: sys.stdout.write( "Output directory %s is a finished rip\n" % - dirname.encode('utf-8')) + discName.encode('utf-8')) if not disambiguate: disambiguate = True continue @@ -357,9 +362,9 @@ break else: - sys.stdout.write("Creating output directory %s\n" % - dirname.encode('utf-8')) - os.makedirs(dirname) +# sys.stdout.write("Creating output directory %s\n" % +# dirname.encode('utf-8')) +# os.makedirs(dirname) break # FIXME: say when we're continuing a rip @@ -507,7 +512,7 @@ ### write disc files discName = self.program.getPath(self.program.outdir, self.options.disc_template, self.mbdiscid, 0, - profile=profile, disambiguate=disambiguate) + profile=profile, disambiguate=disambiguate, forDisk=True) dirname = os.path.dirname(discName) if not os.path.exists(dirname): os.makedirs(dirname) --- ./SOURCECODE/whipper/morituri/./common/program.py 2017-01-27 16:46:15.422134115 -0800 +++ ./common/program.py 2017-02-06 17:18:45.000000000 -0800 @@ -173,7 +173,7 @@ self._presult.persist() def getPath(self, outdir, template, mbdiscid, i, profile=None, - disambiguate=False): + disambiguate=False, forDisk=False): """ Based on the template, get a complete path for the given track, minus extension. @@ -242,14 +242,19 @@ else: # htoa defaults to disc's artist v['a'] = self._filter.filter(self.metadata.artist) - + + if forDisk: + pathIndex = -1 + else: + pathIndex = -2 + # when disambiguating, use catalogNumber then barcode if disambiguate: templateParts = list(os.path.split(template)) if self.metadata.catalogNumber: - templateParts[-2] += ' (%s)' % self.metadata.catalogNumber + templateParts[pathIndex] += ' (%s)' % self.metadata.catalogNumber elif self.metadata.barcode: - templateParts[-2] += ' (%s)' % self.metadata.barcode + templateParts[pathIndex] += ' (%s)' % self.metadata.barcode template = os.path.join(*templateParts) logger.debug('Disambiguated template to %r' % template)