* 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:
@@ -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>
|
2011-08-05 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* morituri/common/Makefile.am:
|
* morituri/common/Makefile.am:
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ class ChecksumTask(gstreamer.GstPipelineTask):
|
|||||||
filesrc location="%s" !
|
filesrc location="%s" !
|
||||||
decodebin name=decode ! audio/x-raw-int !
|
decodebin name=decode ! audio/x-raw-int !
|
||||||
appsink name=sink sync=False emit-signals=True
|
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):
|
def paused(self):
|
||||||
sink = self.pipeline.get_by_name('sink')
|
sink = self.pipeline.get_by_name('sink')
|
||||||
|
|||||||
@@ -67,15 +67,6 @@ def framesToHMSF(frames):
|
|||||||
|
|
||||||
return "%02d:%02d:%02d.%02d" % (h, m, s, f)
|
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):
|
class Persister(object):
|
||||||
"""
|
"""
|
||||||
I wrap an optional pickle to persist an object to disk.
|
I wrap an optional pickle to persist an object to disk.
|
||||||
|
|||||||
@@ -168,9 +168,9 @@ class EncodeTask(gstreamer.GstPipelineTask):
|
|||||||
level name=level !
|
level name=level !
|
||||||
%s ! identity name=identity !
|
%s ! identity name=identity !
|
||||||
filesink location="%s" name=sink''' % (
|
filesink location="%s" name=sink''' % (
|
||||||
common.quoteParse(self._inpath).encode('utf-8'),
|
gstreamer.quoteParse(self._inpath).encode('utf-8'),
|
||||||
self._profile.pipeline,
|
self._profile.pipeline,
|
||||||
common.quoteParse(self._outpath).encode('utf-8'))
|
gstreamer.quoteParse(self._outpath).encode('utf-8'))
|
||||||
|
|
||||||
def parsed(self):
|
def parsed(self):
|
||||||
tagger = self.pipeline.get_by_name('tagger')
|
tagger = self.pipeline.get_by_name('tagger')
|
||||||
@@ -295,7 +295,7 @@ class TagReadTask(gstreamer.GstPipelineTask):
|
|||||||
filesrc location="%s" !
|
filesrc location="%s" !
|
||||||
decodebin name=decoder !
|
decodebin name=decoder !
|
||||||
fakesink''' % (
|
fakesink''' % (
|
||||||
common.quoteParse(self._path).encode('utf-8'))
|
gstreamer.quoteParse(self._path).encode('utf-8'))
|
||||||
|
|
||||||
def bus_eos_cb(self, bus, message):
|
def bus_eos_cb(self, bus, message):
|
||||||
self.debug('eos, scheduling stop')
|
self.debug('eos, scheduling stop')
|
||||||
@@ -334,8 +334,8 @@ class TagWriteTask(task.Task):
|
|||||||
filesrc location="%s" !
|
filesrc location="%s" !
|
||||||
flactag name=tagger !
|
flactag name=tagger !
|
||||||
filesink location="%s"''' % (
|
filesink location="%s"''' % (
|
||||||
common.quoteParse(self._inpath).encode('utf-8'),
|
gstreamer.quoteParse(self._inpath).encode('utf-8'),
|
||||||
common.quoteParse(self._outpath).encode('utf-8')))
|
gstreamer.quoteParse(self._outpath).encode('utf-8')))
|
||||||
|
|
||||||
# set tags
|
# set tags
|
||||||
tagger = self._pipeline.get_by_name('tagger')
|
tagger = self._pipeline.get_by_name('tagger')
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ class AudioLengthTask(gstreamer.GstPipelineTask):
|
|||||||
filesrc location="%s" !
|
filesrc location="%s" !
|
||||||
decodebin ! audio/x-raw-int !
|
decodebin ! audio/x-raw-int !
|
||||||
fakesink name=sink''' % \
|
fakesink name=sink''' % \
|
||||||
common.quoteParse(self._path).encode('utf-8')
|
gstreamer.quoteParse(self._path).encode('utf-8')
|
||||||
|
|
||||||
def paused(self):
|
def paused(self):
|
||||||
self.debug('query duration')
|
self.debug('query duration')
|
||||||
|
|||||||
@@ -9,14 +9,14 @@ gobject.threads_init()
|
|||||||
|
|
||||||
import gst
|
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):
|
def _testSuffix(self, suffix):
|
||||||
self.runner = task.SyncRunner(verbose=False)
|
self.runner = task.SyncRunner(verbose=False)
|
||||||
fd, path = tempfile.mkstemp(suffix=suffix)
|
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 ! " \
|
"audioconvert ! audio/x-raw-int,width=16,depth=16,channels =2 ! " \
|
||||||
"wavenc ! " \
|
"wavenc ! " \
|
||||||
"filesink location=\"%s\" > /dev/null 2>&1" % (
|
"filesink location=\"%s\" > /dev/null 2>&1" % (
|
||||||
common.quoteParse(path).encode('utf-8'), )
|
gstreamer.quoteParse(path).encode('utf-8'), )
|
||||||
os.system(cmd)
|
os.system(cmd)
|
||||||
self.failUnless(os.path.exists(path))
|
self.failUnless(os.path.exists(path))
|
||||||
encodetask = encode.EncodeTask(path, path + '.out',
|
encodetask = encode.EncodeTask(path, path + '.out',
|
||||||
@@ -35,7 +35,7 @@ class PathTestCase(tcommon.TestCase):
|
|||||||
os.unlink(path)
|
os.unlink(path)
|
||||||
os.unlink(path + '.out')
|
os.unlink(path + '.out')
|
||||||
|
|
||||||
class UnicodePathTestCase(PathTestCase, tcommon.UnicodeTestMixin):
|
class UnicodePathTestCase(PathTestCase, common.UnicodeTestMixin):
|
||||||
def testUnicodePath(self):
|
def testUnicodePath(self):
|
||||||
# this test makes sure we can checksum a unicode path
|
# this test makes sure we can checksum a unicode path
|
||||||
self._testSuffix(u'.morituri.test_encode.B\xeate Noire')
|
self._testSuffix(u'.morituri.test_encode.B\xeate Noire')
|
||||||
@@ -47,7 +47,7 @@ class NormalPathTestCase(PathTestCase):
|
|||||||
def testDoubleQuote(self):
|
def testDoubleQuote(self):
|
||||||
self._testSuffix(u'.morituri.test_encode.12" edit')
|
self._testSuffix(u'.morituri.test_encode.12" edit')
|
||||||
|
|
||||||
class TagReadTestCase(tcommon.TestCase):
|
class TagReadTestCase(common.TestCase):
|
||||||
def testRead(self):
|
def testRead(self):
|
||||||
path = os.path.join(os.path.dirname(__file__), u'track.flac')
|
path = os.path.join(os.path.dirname(__file__), u'track.flac')
|
||||||
self.runner = task.SyncRunner(verbose=False)
|
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['audio-codec'], 'FLAC')
|
||||||
self.assertEquals(t.taglist['description'], 'audiotest wave')
|
self.assertEquals(t.taglist['description'], 'audiotest wave')
|
||||||
|
|
||||||
class TagWriteTestCase(tcommon.TestCase):
|
class TagWriteTestCase(common.TestCase):
|
||||||
def testWrite(self):
|
def testWrite(self):
|
||||||
fd, inpath = tempfile.mkstemp(suffix=u'.morituri.tagwrite.flac')
|
fd, inpath = tempfile.mkstemp(suffix=u'.morituri.tagwrite.flac')
|
||||||
|
|
||||||
@@ -92,7 +92,7 @@ class TagWriteTestCase(tcommon.TestCase):
|
|||||||
os.unlink(inpath)
|
os.unlink(inpath)
|
||||||
os.unlink(outpath)
|
os.unlink(outpath)
|
||||||
|
|
||||||
class SafeRetagTestCase(tcommon.TestCase):
|
class SafeRetagTestCase(common.TestCase):
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
self._fd, self._path = tempfile.mkstemp(suffix=u'.morituri.retag.flac')
|
self._fd, self._path = tempfile.mkstemp(suffix=u'.morituri.retag.flac')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user