[SCM] morituri/master: * examples/movecue.py (added): Add a script that moves a .cue file in its corresponding directory.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:08:49 UTC 2014
The following commit has been merged in the master branch:
commit 63515e61f3bae53fb2651a35f4e5c3d2ad6c6744
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun Apr 26 17:29:33 2009 +0000
* examples/movecue.py (added):
Add a script that moves a .cue file in its corresponding directory.
diff --git a/ChangeLog b/ChangeLog
index a98459d..dbe8c4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-04-26 Thomas Vander Stichele <thomas at apestaart dot org>
+ * examples/movecue.py (added):
+ Add a script that moves a .cue file in its corresponding directory.
+
+2009-04-26 Thomas Vander Stichele <thomas at apestaart dot org>
+
* morituri/test/kanye.cue (added):
Add a cue test with mixed mode.
* morituri/image/cue.py:
diff --git a/examples/readcue.py b/examples/movecue.py
similarity index 56%
copy from examples/readcue.py
copy to examples/movecue.py
index 05162c1..f14589f 100644
--- a/examples/readcue.py
+++ b/examples/movecue.py
@@ -1,4 +1,4 @@
-# -*- Mode: Python; test-case-name: morituri.test.test_header -*-
+# -*- Mode: Python -*-
# vi:si:et:sw=4:sts=4:ts=4
# Morituri - for those about to RIP
@@ -20,21 +20,29 @@
# You should have received a copy of the GNU General Public License
# along with morituri. If not, see <http://www.gnu.org/licenses/>.
+# EAC by default saves .cue files one directory up from the rip directories,
+# and only uses the title for the file name.
+# Move the .cue file into the corresponding directory, and rename it
+
+import os
import sys
from morituri.image import cue
-def main(path):
+def move(path):
+ print 'reading', path
cuefile = cue.Cue(path)
cuefile.parse()
- print cuefile.tracks
-
-path = 'test.cue'
+ track = cuefile.tracks[0]
+ idx, file = track.getIndex(1)
+ destdir = os.path.dirname(cuefile.getRealPath(file.path))
-try:
- path = sys.argv[1]
-except IndexError:
- pass
+ if os.path.exists(destdir):
+ dirname = os.path.basename(destdir)
+ destination = os.path.join(destdir, dirname + '.cue')
+ print 'moving %s to %s' % (path, destination)
+ os.rename(path, destination)
-main(path)
+for path in sys.argv[1:]:
+ move(path)
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list