Beispiel #1
0
 def _positionCb(self, unused_pipeline, position):
     self.debug("%r %r", unused_pipeline, position)
     text = None
     timediff = time.time() - self.timestarted
     length = self.project.timeline.duration
     fraction = float(min(position, length)) / float(length)
     if timediff > 5.0 and position:
         # only display ETA after 5s in order to have enough averaging and
         # if the position is non-null
         totaltime = (timediff * float(length) / float(position)) - timediff
         text = beautify_ETA(int(totaltime * gst.SECOND))
     self.updatePosition(fraction, text)
Beispiel #2
0
 def _positionCb(self, unused_pipeline, position):
     self.debug("%r %r", unused_pipeline, position)
     text = None
     timediff = time.time() - self.timestarted
     length = self.project.timeline.duration
     fraction = float(min(position, length)) / float(length)
     if timediff > 5.0 and position:
         # only display ETA after 5s in order to have enough averaging and
         # if the position is non-null
         totaltime = (timediff * float(length) / float(position)) - timediff
         text = beautify_ETA(int(totaltime * gst.SECOND))
     self.updatePosition(fraction, text)
Beispiel #3
0
 def _callForward(self):
     # This function always returns False so that it may be safely
     # invoked via gobject.idle_add(). Use of idle_add() is necessary
     # to ensure that watchers are always called from the main thread,
     # even if progress updates are received from other threads.
     total_target = sum(self._targets)
     total_completed = sum(self._portions)
     if total_target == 0:
         return False
     frac = min(1.0, float(total_completed) / total_target)
     now = time.time()
     remaining = (now - self._start) * (1 - frac) / frac
     for function in self._watchers:
         function(frac, beautify_ETA(int(remaining * gst.SECOND)))
     return False