From 8ec7bcbb9d7a2bfa0881d3892e9bfe33ca11610f Mon Sep 17 00:00:00 2001 From: Thomas Vander Stichele Date: Fri, 5 Aug 2011 19:18:10 +0000 Subject: [PATCH] * morituri/common/checksum.py: * morituri/common/common.py: * morituri/common/encode.py: * morituri/image/image.py: * morituri/test/test_common_encode.py: Moved quoteParse. --- ChangeLog | 9 +++++++++ morituri/common/checksum.py | 2 +- morituri/common/common.py | 9 --------- morituri/common/encode.py | 10 +++++----- morituri/image/image.py | 2 +- morituri/test/test_common_encode.py | 18 +++++++++--------- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4c57cd1..fcc9e3b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2011-08-05 Thomas Vander Stichele + + * 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 * morituri/common/Makefile.am: diff --git a/morituri/common/checksum.py b/morituri/common/checksum.py index 3f8a7c4..4a5ce55 100644 --- a/morituri/common/checksum.py +++ b/morituri/common/checksum.py @@ -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') diff --git a/morituri/common/common.py b/morituri/common/common.py index 7833bf0..e6612ca 100644 --- a/morituri/common/common.py +++ b/morituri/common/common.py @@ -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. diff --git a/morituri/common/encode.py b/morituri/common/encode.py index c2aa2a0..6070f89 100644 --- a/morituri/common/encode.py +++ b/morituri/common/encode.py @@ -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') diff --git a/morituri/image/image.py b/morituri/image/image.py index 6a8d01b..0e7c271 100644 --- a/morituri/image/image.py +++ b/morituri/image/image.py @@ -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') diff --git a/morituri/test/test_common_encode.py b/morituri/test/test_common_encode.py index bad9f2e..51fba8d 100644 --- a/morituri/test/test_common_encode.py +++ b/morituri/test/test_common_encode.py @@ -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')