* morituri/common/checksum.py:

* morituri/common/common.py:
	* morituri/common/encode.py:
	* morituri/image/image.py:
	* morituri/test/test_common_encode.py:
	  Moved quoteParse.
This commit is contained in:
Thomas Vander Stichele
2011-08-05 19:18:10 +00:00
parent 95cd741904
commit 8ec7bcbb9d
6 changed files with 25 additions and 25 deletions

View File

@@ -1,3 +1,12 @@
2011-08-05 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/checksum.py:
* morituri/common/common.py:
* morituri/common/encode.py:
* morituri/image/image.py:
* morituri/test/test_common_encode.py:
Moved quoteParse.
2011-08-05 Thomas Vander Stichele <thomas at apestaart dot org>
* morituri/common/Makefile.am:

View File

@@ -84,7 +84,7 @@ class ChecksumTask(gstreamer.GstPipelineTask):
filesrc location="%s" !
decodebin name=decode ! audio/x-raw-int !
appsink name=sink sync=False emit-signals=True
''' % common.quoteParse(self._path).encode('utf-8')
''' % gstreamer.quoteParse(self._path).encode('utf-8')
def paused(self):
sink = self.pipeline.get_by_name('sink')

View File

@@ -67,15 +67,6 @@ def framesToHMSF(frames):
return "%02d:%02d:%02d.%02d" % (h, m, s, f)
def quoteParse(path):
"""
Quote a path for use in gst.parse_launch.
"""
# Make sure double quotes are escaped. See
# morituri.test.test_common_checksum
return path.replace('"', '\\"')
class Persister(object):
"""
I wrap an optional pickle to persist an object to disk.

View File

@@ -168,9 +168,9 @@ class EncodeTask(gstreamer.GstPipelineTask):
level name=level !
%s ! identity name=identity !
filesink location="%s" name=sink''' % (
common.quoteParse(self._inpath).encode('utf-8'),
gstreamer.quoteParse(self._inpath).encode('utf-8'),
self._profile.pipeline,
common.quoteParse(self._outpath).encode('utf-8'))
gstreamer.quoteParse(self._outpath).encode('utf-8'))
def parsed(self):
tagger = self.pipeline.get_by_name('tagger')
@@ -295,7 +295,7 @@ class TagReadTask(gstreamer.GstPipelineTask):
filesrc location="%s" !
decodebin name=decoder !
fakesink''' % (
common.quoteParse(self._path).encode('utf-8'))
gstreamer.quoteParse(self._path).encode('utf-8'))
def bus_eos_cb(self, bus, message):
self.debug('eos, scheduling stop')
@@ -334,8 +334,8 @@ class TagWriteTask(task.Task):
filesrc location="%s" !
flactag name=tagger !
filesink location="%s"''' % (
common.quoteParse(self._inpath).encode('utf-8'),
common.quoteParse(self._outpath).encode('utf-8')))
gstreamer.quoteParse(self._inpath).encode('utf-8'),
gstreamer.quoteParse(self._outpath).encode('utf-8')))
# set tags
tagger = self._pipeline.get_by_name('tagger')

View File

@@ -161,7 +161,7 @@ class AudioLengthTask(gstreamer.GstPipelineTask):
filesrc location="%s" !
decodebin ! audio/x-raw-int !
fakesink name=sink''' % \
common.quoteParse(self._path).encode('utf-8')
gstreamer.quoteParse(self._path).encode('utf-8')
def paused(self):
self.debug('query duration')

View File

@@ -9,14 +9,14 @@ gobject.threads_init()
import gst
from morituri.common import encode, log, common
from morituri.common import encode, log
from morituri.extern.task import task
from morituri.extern.task import task, gstreamer
from morituri.test import common as tcommon
from morituri.test import common
class PathTestCase(tcommon.TestCase):
class PathTestCase(common.TestCase):
def _testSuffix(self, suffix):
self.runner = task.SyncRunner(verbose=False)
fd, path = tempfile.mkstemp(suffix=suffix)
@@ -25,7 +25,7 @@ class PathTestCase(tcommon.TestCase):
"audioconvert ! audio/x-raw-int,width=16,depth=16,channels =2 ! " \
"wavenc ! " \
"filesink location=\"%s\" > /dev/null 2>&1" % (
common.quoteParse(path).encode('utf-8'), )
gstreamer.quoteParse(path).encode('utf-8'), )
os.system(cmd)
self.failUnless(os.path.exists(path))
encodetask = encode.EncodeTask(path, path + '.out',
@@ -35,7 +35,7 @@ class PathTestCase(tcommon.TestCase):
os.unlink(path)
os.unlink(path + '.out')
class UnicodePathTestCase(PathTestCase, tcommon.UnicodeTestMixin):
class UnicodePathTestCase(PathTestCase, common.UnicodeTestMixin):
def testUnicodePath(self):
# this test makes sure we can checksum a unicode path
self._testSuffix(u'.morituri.test_encode.B\xeate Noire')
@@ -47,7 +47,7 @@ class NormalPathTestCase(PathTestCase):
def testDoubleQuote(self):
self._testSuffix(u'.morituri.test_encode.12" edit')
class TagReadTestCase(tcommon.TestCase):
class TagReadTestCase(common.TestCase):
def testRead(self):
path = os.path.join(os.path.dirname(__file__), u'track.flac')
self.runner = task.SyncRunner(verbose=False)
@@ -57,7 +57,7 @@ class TagReadTestCase(tcommon.TestCase):
self.assertEquals(t.taglist['audio-codec'], 'FLAC')
self.assertEquals(t.taglist['description'], 'audiotest wave')
class TagWriteTestCase(tcommon.TestCase):
class TagWriteTestCase(common.TestCase):
def testWrite(self):
fd, inpath = tempfile.mkstemp(suffix=u'.morituri.tagwrite.flac')
@@ -92,7 +92,7 @@ class TagWriteTestCase(tcommon.TestCase):
os.unlink(inpath)
os.unlink(outpath)
class SafeRetagTestCase(tcommon.TestCase):
class SafeRetagTestCase(common.TestCase):
def setUp(self):
self._fd, self._path = tempfile.mkstemp(suffix=u'.morituri.retag.flac')