[SCM] morituri/master: * morituri/program/cdparanoia.py: Use a temporary file to rip to.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:08:54 UTC 2014
The following commit has been merged in the master branch:
commit be20385fd40e30d888eb9ec5e10213c38433570c
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Sun May 3 19:17:21 2009 +0000
* morituri/program/cdparanoia.py:
Use a temporary file to rip to.
diff --git a/ChangeLog b/ChangeLog
index b3dba5e..198fc41 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-05-03 Thomas Vander Stichele <thomas at apestaart dot org>
+ * morituri/program/cdparanoia.py:
+ Use a temporary file to rip to.
+
+2009-05-03 Thomas Vander Stichele <thomas at apestaart dot org>
+
* examples/readtrack.py:
Allow specifying the track to save.
diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py
index 2350e0d..62ec70c 100644
--- a/morituri/program/cdparanoia.py
+++ b/morituri/program/cdparanoia.py
@@ -23,7 +23,9 @@
import os
import re
import stat
+import shutil
import subprocess
+import tempfile
from morituri.common import task, log, common, checksum
from morituri.extern import asyncsub
@@ -198,6 +200,7 @@ class ReadVerifyTrackTask(task.MultiTask):
"""
I am a task that reads and verifies a track using cdparanoia.
+ @ivar path: the path where the file is to be stored.
@ivar checksum: the checksum of the track.
"""
@@ -214,17 +217,25 @@ class ReadVerifyTrackTask(task.MultiTask):
@param offset: read offset, in samples
@type offset: int
"""
+
+ self.path = path
+
+ # FIXME: choose a dir on the same disk/dir as the final path
+ fd, tmppath = tempfile.mkstemp(suffix='.morituri.wav')
+ os.close(fd)
+ self._tmppath = tmppath
+
self.tasks = []
self.tasks.append(
- ReadTrackTask(path, table, start, stop, offset))
+ ReadTrackTask(tmppath, table, start, stop, offset))
self.tasks.append(
- checksum.CRC32Task(path))
- t = ReadTrackTask(path, table, start, stop, offset)
+ checksum.CRC32Task(tmppath))
+ t = ReadTrackTask(tmppath, table, start, stop, offset)
t.description = 'Verifying track...'
self.tasks.append(
- ReadTrackTask(path, table, start, stop, offset))
+ ReadTrackTask(tmppath, table, start, stop, offset))
self.tasks.append(
- checksum.CRC32Task(path))
+ checksum.CRC32Task(tmppath))
self.checksum = None
@@ -234,6 +245,7 @@ class ReadVerifyTrackTask(task.MultiTask):
if c1 == c2:
self.info('Checksums match, %08x' % c1)
self.checksum = checksum
+ shutil.move(self._tmppath, self.path)
else:
print 'ERROR: read and verify failed'
self.checksum = None
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list