[rygel/wip/g-i: 520/521] wip: Sample code and notes
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/g-i: 520/521] wip: Sample code and notes
- Date: Mon, 27 May 2013 10:08:17 +0000 (UTC)
commit f366472397c5b4a3dc70df18b0a5e86a1815c11a
Author: Jens Georg <jensg openismus com>
Date: Mon May 27 01:40:23 2013 +0900
wip: Sample code and notes
doc/gi.txt | 9 +++++++++
examples/example-renderer.py | 26 ++++++++++++++++++++++++++
examples/sample-server.py | 22 ++++++++++++++++++++++
3 files changed, 57 insertions(+), 0 deletions(-)
---
diff --git a/doc/gi.txt b/doc/gi.txt
new file mode 100644
index 0000000..9f5aab4
--- /dev/null
+++ b/doc/gi.txt
@@ -0,0 +1,9 @@
+- How to use default implementations from python or provide a default for all
+ virtual functions with specific overides?
+ class Foo(GObject.Object, namespace.MyInterface):
+ def do_thing(self):
+ pass
+ # everything else from MyInteface throws NotImplemented exception
+- How to implement non-trivial r/w properties?
+- How to implement properties returning GStrv?
+- Get rid of libgee/generics in public API
diff --git a/examples/example-renderer.py b/examples/example-renderer.py
new file mode 100755
index 0000000..8c21319
--- /dev/null
+++ b/examples/example-renderer.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+from gi.repository import RygelCore as rc
+from gi.repository import RygelRenderer as rr
+from gi.repository import GObject
+
+class ExamplePlayer(GObject.Object, rr.MediaPlayer):
+ __gtype_name = "RygelPythonExamplePlayer"
+ volume = GObject.property (type = float, default = 1.0)
+ uri = GObject.property (type = str, default = "")
+ position = GObject.property (type = int, default = 0)
+ duration = GObject.property (type = int, default = 0)
+
+ @GObject.property
+ def allowed_playback_speeds(self):
+ return ["1"]
+
+ def __init__(self):
+ GObject.Object.__init__(self)
+
+d = rr.MediaRenderer (title = "DLNA renderer from Python!",
+ player = ExamplePlayer())
+
+d.add_interface ("lo")
+
+GObject.MainLoop().run()
diff --git a/examples/sample-server.py b/examples/sample-server.py
new file mode 100644
index 0000000..342ba64
--- /dev/null
+++ b/examples/sample-server.py
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+
+from gi.repository import GObject
+from gi.repository import RygelCore as rc
+from gi.repository import RygelServer as rs
+
+rs.MediaEngine.init ()
+
+c = rs.SimpleContainer.root ("DLNA from Python!")
+i = rs.VideoItem (id = "0001",
+ parent = c,
+ title = "Test Video",
+ upnp_class = rs.ImageItem.UPNP_CLASS)
+i.set_property ("mime-type", "video/ogv")
+c.add_child_item (i)
+
+d = rs.MediaServer (title = "DLNA server from Python!",
+ root_container = c,
+ capabilities = rc.PluginCapabilities.NONE)
+d.add_interface ("lo")
+
+GObject.MainLoop().run()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]