Only log output and write progress to db if it has changed

De-noisify the transcoding log and db updates. Previously we would log
and save the progress percentage every second, even if it had not changed
at all. Save progress:oercentage in the Transcoder and only log/update
when the percentage has actually changed.

Signed-off-by: Sebastian Spaeth <Sebastian@SSpaeth.de>
This commit is contained in:
Sebastian Spaeth 2012-12-19 15:43:38 +01:00
parent 4d9b426ccf
commit 0efc4e4dbf

View File

@ -636,7 +636,7 @@ class VideoTranscoder:
'''
def __init__(self):
_log.info('Initializing VideoTranscoder...')
self.progress_percentage = None
self.loop = gobject.MainLoop()
def transcode(self, src, dst, **kwargs):
@ -913,12 +913,14 @@ class VideoTranscoder:
elif message.type == gst.MESSAGE_ELEMENT:
if message.structure.get_name() == 'progress':
data = dict(message.structure)
# Update progress state if it has changed
if self.progress_percentage != data.get('percent'):
self.progress_percentage = data.get('percent')
if self._progress_callback:
self._progress_callback(data.get('percent'))
if self._progress_callback:
self._progress_callback(data.get('percent'))
_log.info('{percent}% done...'.format(
percent=data.get('percent')))
_log.info('{percent}% done...'.format(
percent=data.get('percent')))
_log.debug(data)
elif t == gst.MESSAGE_ERROR: