[gnome-music] Revert "player: rate-limit sync_playing signals: 1 per second"



commit 23eef547293c5fcac2523f5aafa44c56fbd72a7f
Author: Vadim Rutkovsky <vrutkovs redhat com>
Date:   Mon Aug 24 19:12:41 2015 +0200

    Revert "player: rate-limit sync_playing signals: 1 per second"
    
    This reverts commit f133fb0b2273b845e89e02d70268d1875a0e1026.

 gnomemusic/__init__.py |   18 ------------------
 gnomemusic/player.py   |    4 ++--
 2 files changed, 2 insertions(+), 20 deletions(-)
---
diff --git a/gnomemusic/__init__.py b/gnomemusic/__init__.py
index a7e2a01..883f76b 100644
--- a/gnomemusic/__init__.py
+++ b/gnomemusic/__init__.py
@@ -66,24 +66,6 @@ def log(fn):
     return wrapped
 
 
-def RateLimited(maxPerSecond):
-    minInterval = 1.0 / float(maxPerSecond)
-
-    def decorate(func):
-        lastTimeCalled = [0.0]
-
-        def rateLimitedFunction(*args, **kargs):
-            elapsed = time.clock() - lastTimeCalled[0]
-            leftToWait = minInterval - elapsed
-            if leftToWait > 0:
-                return
-            ret = func(*args, **kargs)
-            lastTimeCalled[0] = time.clock()
-            return ret
-        return rateLimitedFunction
-    return decorate
-
-
 class TrackerWrapper:
     class __TrackerWrapper:
         def __init__(self):
diff --git a/gnomemusic/player.py b/gnomemusic/player.py
index 54ffdfb..caca45a 100644
--- a/gnomemusic/player.py
+++ b/gnomemusic/player.py
@@ -51,7 +51,7 @@ import requests
 import time
 from threading import Thread
 
-from gnomemusic import log, RateLimited
+from gnomemusic import log
 import logging
 logger = logging.getLogger(__name__)
 
@@ -241,6 +241,7 @@ class Player(GObject.GObject):
         self._sync_prev_next()
         self._sync_repeat_image()
 
+    @log
     def _on_bus_state_changed(self, bus, message):
         # Note: not all state changes are signaled through here, in particular
         # transitions between Gst.State.READY and Gst.State.NULL are never async
@@ -545,7 +546,6 @@ class Player(GObject.GObject):
         return self._get_playing()
 
     @log
-    @RateLimited(1)
     def _sync_playing(self):
         if self._get_playing():
             image = self._pauseImage


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