* morituri/image/cue.py:

getRealPath should be here, it doesn't need anything outside
	  the .cue file
	* morituri/image/image.py:
	  Proxy it here.
This commit is contained in:
Thomas Vander Stichele
2009-04-25 16:06:23 +00:00
parent 10e5ec0b18
commit 03ef79ec84
3 changed files with 42 additions and 26 deletions

View File

@@ -47,32 +47,7 @@ class Image:
"""
Translate the .cue's FILE to an existing path.
"""
if os.path.exists(path):
return path
# .cue FILE statements have Windows-style path separators, so convert
tpath = os.path.join(*path.split('\\'))
candidatePaths = []
# if the path is relative:
# - check relatively to the cue file
# - check only the filename part relative to the cue file
if tpath == os.path.abspath(tpath):
candidatePaths.append(tPath)
else:
candidatePaths.append(os.path.join(
os.path.dirname(self._path), tpath))
candidatePaths.append(os.path.join(
os.path.dirname(self._path), os.path.basename(tpath)))
for candidate in candidatePaths:
noext, _ = os.path.splitext(candidate)
for ext in ['wav', 'flac']:
cpath = '%s.%s' % (noext, ext)
if os.path.exists(cpath):
return cpath
raise KeyError, "Cannot find file for %s" % path
return self.cue.getRealPath(path)
def setup(self, runner):
"""