debug and cleanup

This commit is contained in:
Thomas Vander Stichele
2013-02-24 12:19:46 +01:00
parent f05ec0f2e9
commit a692542307
2 changed files with 14 additions and 5 deletions

View File

@@ -242,6 +242,8 @@ class EncodeTask(ctask.GstPipelineTask):
interval = self.gst.SECOND
if interval > duration:
interval = duration / 2
self.debug('Setting level interval to %s, duration %s',
self.gst.TIME_ARGS(interval), self.gst.TIME_ARGS(duration))
self._level.set_property('interval', interval)
# add a probe so we can track progress
# we connect to level because this gives us offset in samples
@@ -291,10 +293,14 @@ class EncodeTask(ctask.GstPipelineTask):
if self._peakdB is not None:
self.debug('peakdB %r', self._peakdB)
self.peak = math.sqrt(math.pow(10, self._peakdB / 10.0))
else:
self.warning('No peak found, something went wrong!')
# workaround for when the file is too short to have volume ?
# self.peak = 0.0
return
self.warning('No peak found.')
if self._duration:
self.warning('GStreamer level element did not send messages.')
# workaround for when the file is too short to have volume ?
# self.peak = 0.0
class TagReadTask(ctask.GstPipelineTask):

View File

@@ -49,7 +49,7 @@ class RCList(logcommand.LogCommand):
self.stdout.write('%s: %s - %s\n' % (
cddbid, artist.encode('utf-8'), title.encode('utf-8')))
class RCLog(logcommand.LogCommand):
@@ -155,6 +155,9 @@ class Encode(logcommand.LogCommand):
runner.run(encodetask)
self.stdout.write('Peak level: %r\n' % encodetask.peak)
self.stdout.write('Encoded to %s\n' % toPath.encode('utf-8'))
class Tag(logcommand.LogCommand):
summary = "run a tag reading task"