[SCM] morituri/master: * morituri/image/image.py: Also look for audio file basename relative to cue file.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:08:46 UTC 2014
The following commit has been merged in the master branch:
commit bce17ff3a2457b60387a1df8cc93c4991ff03938
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Mon Apr 13 20:35:36 2009 +0000
* morituri/image/image.py:
Also look for audio file basename relative to cue file.
diff --git a/ChangeLog b/ChangeLog
index 37db8ea..89d08d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-04-13 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/image/image.py:
+ Also look for audio file basename relative to cue file.
+
+2009-04-13 Thomas Vander Stichele <thomas at apestaart dot org>
+
* examples/ARcue.py:
Make output a bit nicer, mentioning whether tracks were
accurately ripped.
diff --git a/morituri/image/image.py b/morituri/image/image.py
index bdd36e8..fb3f3cd 100644
--- a/morituri/image/image.py
+++ b/morituri/image/image.py
@@ -52,15 +52,25 @@ class Image:
# .cue FILE statements have Windows-style path separators, so convert
tpath = os.path.join(*path.split('\\'))
- # if the path is relative, make it absolute relative to the cue file
- if tpath != os.path.abspath(tpath):
- tpath = os.path.join(os.path.dirname(self._path), tpath)
-
- noext, _ = os.path.splitext(tpath)
- for ext in ['wav', 'flac']:
- cpath = '%s.%s' % (noext, ext)
- if os.path.exists(cpath):
- return cpath
+ 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
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list