[gnome-music] player: trap TypeErrors if we're passing too big 'seeked' value



commit 2c11dfc89d3a7e8bcb1c0a9ba3d0885bb0270b3d
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Sat Jul 12 18:44:54 2014 +0200

    player: trap TypeErrors if we're passing too big 'seeked' value
    
    https://bugzilla.gnome.org/show_bug.cgi?id=733095

 gnomemusic/player.py |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 4ee5f4c..262c8d7 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -664,13 +664,21 @@ class Player(GObject.GObject):
         seconds = scroll.get_value() / 60
         if seconds != self.duration:
             self.player.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, seconds * 
1000000000)
-            self.emit('seeked', seconds * 1000000)
+            try:
+                self.emit('seeked', seconds * 1000000)
+            except TypeError:
+                # See https://bugzilla.gnome.org/show_bug.cgi?id=733095
+                pass
         else:
             duration = self.player.query_duration(Gst.Format.TIME)
             if duration:
                 # Rewind a second back before the track end
                 self.player.seek_simple(Gst.Format.TIME, Gst.SeekFlags.FLUSH | Gst.SeekFlags.KEY_UNIT, 
duration[1] - 1000000000)
-                self.emit('seeked', (duration[1] - 1000000000) / 1000)
+                try:
+                    self.emit('seeked', (duration[1] - 1000000000) / 1000)
+                except TypeError:
+                    # See https://bugzilla.gnome.org/show_bug.cgi?id=733095
+                    pass
         return True
 
     # MPRIS


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