1be7a49ed150 — Oben Sonne 10 years ago
server: implement player control methods in remuco bridge
1 files changed, 22 insertions(+), 8 deletions(-)

M server/src/remuco/bridges/__init__.py
M server/src/remuco/bridges/__init__.py +22 -8
@@ 152,6 152,13 @@ class DBusBridge(Bridge):
     busbasename = None
     signalhandler = None # player events
 
+    def __init__(self, *args, **kwds):
+        super(DBusBridge, self).__init__(*args, **kwds)
+        self.voidhandler = {
+            'reply_handler': self.onvoid,
+            'error_handler': self.ondbuserror,
+        }
+
     def shutdown(self):
         super(DBusBridge, self).shutdown()
         for handler in self.signalhandler or ():

          
@@ 170,6 177,13 @@ class DBusBridge(Bridge):
         """
         self.rem.warning("dbus error:\n%s", framedump(error, "!"))
 
+    def onvoid(self, *args, **kwds):
+        """
+        DBus reply handler for no or unhandled results.
+
+        """
+        pass
+
 # =============================================================================
 # base bridge class for bridges using the remuco dbus interface
 # =============================================================================

          
@@ 274,28 288,28 @@ class RemucoBridge(DBusBridge):
     # -------------------------------------------------------------------------
 
     def setplaying(self, enabled):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.SetPlaying(enabled, **self.voidhandler)
 
     def playnext(self):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.PlayNext(**self.voidhandler)
 
     def playprevious(self):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.PlayPrevious(**self.voidhandler)
 
     def seekto(self, position):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.SeekTo(position, **self.voidhandler)
 
     def setvolume(self, level):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.SetVolume(level, **self.voidhandler)
 
     def setrepeat(self, mode):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.SetRepeat(mode, **self.voidhandler)
 
     def setshuffle(self, mode):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.SetShuffle(mode, **self.voidhandler)
 
     def setrating(self, value):
-        pass # TODO: convert to DBUS-CALL
+        self.rp.SetRating(value, **self.voidhandler)
 
     def gettracklist(self, path, reply):