[pitivi] utils/pipeline: Properly raise errors for invalid durations or seek times



commit da9f7900c1ea9cc22ef5cf49338278691694f147
Author: Jean-François Fortin Tam <nekohayo gmail com>
Date:   Sun Mar 31 18:02:36 2013 +0200

    utils/pipeline: Properly raise errors for invalid durations or seek times
    
    Because we still see cases where they are None, and tracebacks are annoying.

 pitivi/utils/pipeline.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/pitivi/utils/pipeline.py b/pitivi/utils/pipeline.py
index 574b432..0081fd9 100644
--- a/pitivi/utils/pipeline.py
+++ b/pitivi/utils/pipeline.py
@@ -285,7 +285,10 @@ class SimplePipeline(Signallable, Loggable):
         self.log("format %r" % format)
 
         dur = self._getDuration(format)
-        self.log("Got duration %s" % print_ns(dur))
+        if dur is None:
+            self.error("Invalid duration: None")
+        else:
+            self.log("Got duration %s" % print_ns(dur))
         if self._duration != dur:
             self.emit("duration-changed", dur)
 
@@ -372,6 +375,9 @@ class SimplePipeline(Signallable, Loggable):
         self.emit('position', position)
 
     def seekRelative(self, time):
+        if not time:
+            self.error("Trying to seek to an invalid time: %s", time)
+            return
         seekvalue = max(0, min(self.getPosition() + time, self.getDuration()))
         self.simple_seek(seekvalue)
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]