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:
parent
4d9b426ccf
commit
0efc4e4dbf
@ -636,7 +636,7 @@ class VideoTranscoder:
|
|||||||
'''
|
'''
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
_log.info('Initializing VideoTranscoder...')
|
_log.info('Initializing VideoTranscoder...')
|
||||||
|
self.progress_percentage = None
|
||||||
self.loop = gobject.MainLoop()
|
self.loop = gobject.MainLoop()
|
||||||
|
|
||||||
def transcode(self, src, dst, **kwargs):
|
def transcode(self, src, dst, **kwargs):
|
||||||
@ -913,12 +913,14 @@ class VideoTranscoder:
|
|||||||
elif message.type == gst.MESSAGE_ELEMENT:
|
elif message.type == gst.MESSAGE_ELEMENT:
|
||||||
if message.structure.get_name() == 'progress':
|
if message.structure.get_name() == 'progress':
|
||||||
data = dict(message.structure)
|
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:
|
_log.info('{percent}% done...'.format(
|
||||||
self._progress_callback(data.get('percent'))
|
percent=data.get('percent')))
|
||||||
|
|
||||||
_log.info('{percent}% done...'.format(
|
|
||||||
percent=data.get('percent')))
|
|
||||||
_log.debug(data)
|
_log.debug(data)
|
||||||
|
|
||||||
elif t == gst.MESSAGE_ERROR:
|
elif t == gst.MESSAGE_ERROR:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user