[rygel] examples: Fix renderer example
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] examples: Fix renderer example
- Date: Sun, 28 Sep 2014 15:43:13 +0000 (UTC)
commit 8cee4d046af54b0fcfda0093be12318098d86775
Author: Jens Georg <mail jensge org>
Date: Sun Sep 28 17:38:29 2014 +0200
examples: Fix renderer example
Signed-off-by: Jens Georg <mail jensge org>
examples/gi/example-renderer.py | 65 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 64 insertions(+), 1 deletions(-)
---
diff --git a/examples/gi/example-renderer.py b/examples/gi/example-renderer.py
index 5fa6029..69036a9 100755
--- a/examples/gi/example-renderer.py
+++ b/examples/gi/example-renderer.py
@@ -2,8 +2,12 @@
from gi.repository import RygelCore as rc
from gi.repository import RygelRenderer as rr
+from gi.repository import GLib
from gi.repository import GObject
+import gi
+import sys
+
class ExamplePlayer(GObject.Object, rr.MediaPlayer):
__gtype_name = "RygelPythonExamplePlayer"
@@ -45,12 +49,71 @@ class ExamplePlayer(GObject.Object, rr.MediaPlayer):
def do_set_volume(self, _volume):
self.volume = _volume;
+ def do_get_playback_speed(self):
+ return "1.0"
+
+ def do_get_duration(self):
+ return 0
+
+ def do_set_uri(self, uri):
+ self.uri = uri
+
+ def do_get_uri(self):
+ return self.uri
+
+ def do_get_metadata(self):
+ return self.metadata
+
+ def do_set_playback_state(self, new_state):
+ print("Client is requesting new state " + new_state)
+ self.playback_state = new_state
+
+ def do_get_playback_state(self):
+ return self.playback_state
+
+ def do_get_can_seek(self):
+ return False
+
+ def do_get_can_seek_bytes(self):
+ return False
+
+ def do_get_allowed_playback_speeds(self):
+ return ["1.0"]
+
+ def do_get_position(self):
+ return 0
+
+ def do_get_byte_position(self):
+ return 0
+
+ def do_set_mime_type(self, mime_type):
+ print("Setting mime type to " + mime_type)
+ self.mime_type = mime_type
+
+ def do_set_content_features(self, content_features):
+ print("Setting content features to " + content_features)
+ self.content_features = content_features
+
+ def do_set_metadata(self, metadata):
+ print("Setting meta data to " + metadata)
+ self.metadata = metadata
+
def __init__(self):
GObject.Object.__init__(self)
+major,minor,micro = gi.version_info
+
+ok = (major >= 3 and minor > 13) or (major == 3 and minor == 13 and micro >= 4)
+
+if not ok:
+ print("Need at least pygobject version 3.13.4 to work")
+ sys.exit(-1)
+else:
+ print("Proper PyGObject version found!")
+
d = rr.MediaRenderer (title = "DLNA renderer from Python!",
player = ExamplePlayer())
d.add_interface ("lo")
-GObject.MainLoop().run()
+GLib.MainLoop().run()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]