[SCM] morituri/master: * morituri/common/encode.py: * morituri/program/cdparanoia.py: * morituri/rip/cd.py: Clean up the temporary unencoded file. Pass profile as objects to tasks, so that temp files have the right extension.
js at users.alioth.debian.org
js at users.alioth.debian.org
Sun Oct 19 20:09:05 UTC 2014
The following commit has been merged in the master branch:
commit 2f3c0fdcafeb6173bbf80ed3b85104d69035e11f
Author: Thomas Vander Stichele <thomas (at) apestaart (dot) org>
Date: Mon Jun 1 09:45:30 2009 +0000
* morituri/common/encode.py:
* morituri/program/cdparanoia.py:
* morituri/rip/cd.py:
Clean up the temporary unencoded file.
Pass profile as objects to tasks, so that temp files have the right
extension.
diff --git a/ChangeLog b/ChangeLog
index e9010ee..2cc186c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,15 @@
* morituri/common/encode.py:
* morituri/program/cdparanoia.py:
+ * morituri/rip/cd.py:
+ Clean up the temporary unencoded file.
+ Pass profile as objects to tasks, so that temp files have the right
+ extension.
+
+2009-06-01 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * morituri/common/encode.py:
+ * morituri/program/cdparanoia.py:
Add encoding profiles, kept simple for now as a class and
subclasses. Use them to encode. Calculate peak level while
encoding, compared to EAC and replaygain's value.
diff --git a/morituri/common/encode.py b/morituri/common/encode.py
index d2b6164..b8f2466 100644
--- a/morituri/common/encode.py
+++ b/morituri/common/encode.py
@@ -81,6 +81,8 @@ class EncodeTask(task.Task):
def __init__(self, inpath, outpath, profile, taglist=None):
"""
+ @param profile: encoding profile
+ @type profile: L{Profile}
"""
self._inpath = inpath
self._outpath = outpath
@@ -88,7 +90,7 @@ class EncodeTask(task.Task):
self._level = None
self._peakdB = None
- self._profile = PROFILES[profile]
+ self._profile = profile
def start(self, runner):
task.Task.start(self, runner)
@@ -186,5 +188,4 @@ class EncodeTask(task.Task):
self.debug('set state to NULL')
task.Task.stop(self)
-
self.peak = math.pow(10, self._peakdB / 10.0)
diff --git a/morituri/program/cdparanoia.py b/morituri/program/cdparanoia.py
index 479a52e..b5726a1 100644
--- a/morituri/program/cdparanoia.py
+++ b/morituri/program/cdparanoia.py
@@ -231,6 +231,9 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
@ivar peak: the peak level of the track
"""
+ _tmpwavpath = None
+ _tmppath = None
+
def __init__(self, path, table, start, stop, offset=0, device=None, profile=None):
"""
@param path: where to store the ripped track
@@ -246,7 +249,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
@param device: the device to rip from
@type device: str
@param profile: the encoding profile
- @type profile: str
+ @type profile: L{encode.Profile}
"""
task.MultiSeparateTask.__init__(self)
@@ -255,7 +258,7 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
# 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._tmpwavpath = tmppath
self.tasks = []
self.tasks.append(
@@ -266,8 +269,8 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
self.tasks.append(t)
self.tasks.append(checksum.CRC32Task(tmppath))
- # FIXME: clean this up
- fd, tmpoutpath = tempfile.mkstemp(suffix='.morituri.flac')
+ fd, tmpoutpath = tempfile.mkstemp(suffix='.morituri.%s' %
+ profile.extension)
os.close(fd)
self._tmppath = tmpoutpath
self.tasks.append(encode.EncodeTask(tmppath, tmpoutpath, profile))
@@ -290,6 +293,10 @@ class ReadVerifyTrackTask(task.MultiSeparateTask):
if self.tasks[5].checksum != self.checksum:
self.error('Encoding failed, checksum does not match')
+
+ # delete the unencoded file
+ os.unlink(self._tmpwavpath)
+
try:
shutil.move(self._tmppath, self.path)
self.checksum = checksum
diff --git a/morituri/rip/cd.py b/morituri/rip/cd.py
index 80d78ce..1029b92 100644
--- a/morituri/rip/cd.py
+++ b/morituri/rip/cd.py
@@ -286,7 +286,7 @@ class Rip(logcommand.LogCommand):
start, stop - 1,
offset=int(self.options.offset),
device=self.parentCommand.options.device,
- profile=self.options.profile)
+ profile=profile)
function(runner, t)
if t.checksum is not None:
@@ -314,13 +314,14 @@ class Rip(logcommand.LogCommand):
# FIXME: optionally allow overriding reripping
if not os.path.exists(path):
- print 'Ripping track %d: %s' % (i + 1, os.path.basename(path))
+ print 'Ripping track %d of %d: %s' % (
+ i + 1, len(itable.tracks), os.path.basename(path))
t = cdparanoia.ReadVerifyTrackTask(path, ittoc,
ittoc.getTrackStart(i + 1),
ittoc.getTrackEnd(i + 1),
offset=int(self.options.offset),
device=self.parentCommand.options.device,
- profile=self.options.profile)
+ profile=profile)
t.description = 'Reading Track %d' % (i + 1)
function(runner, t)
if t.checksum:
--
morituri packaging
More information about the pkg-multimedia-commits
mailing list