[rygel] mediathek: Add change tracking
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] mediathek: Add change tracking
- Date: Mon, 29 Oct 2012 14:53:18 +0000 (UTC)
commit 09f2648ad8457c721fbdb6b316a310e99443abe9
Author: Jens Georg <jensg openismus com>
Date: Mon Oct 29 15:07:57 2012 +0100
mediathek: Add change tracking
src/plugins/mediathek/rygel-mediathek-plugin.vala | 5 ++++-
.../mediathek/rygel-mediathek-root-container.vala | 13 +++++++++----
.../mediathek/rygel-mediathek-rss-container.vala | 12 ++++++++----
3 files changed, 21 insertions(+), 9 deletions(-)
---
diff --git a/src/plugins/mediathek/rygel-mediathek-plugin.vala b/src/plugins/mediathek/rygel-mediathek-plugin.vala
index 1a37335..e9d4313 100644
--- a/src/plugins/mediathek/rygel-mediathek-plugin.vala
+++ b/src/plugins/mediathek/rygel-mediathek-plugin.vala
@@ -45,6 +45,9 @@ public class Rygel.Mediathek.Plugin : Rygel.MediaServerPlugin {
public const string NAME = "ZDFMediathek";
public Plugin () {
- base (RootContainer.get_instance (), Plugin.NAME);
+ base (RootContainer.get_instance (),
+ Plugin.NAME,
+ null,
+ PluginCapabilities.TRACK_CHANGES);
}
}
diff --git a/src/plugins/mediathek/rygel-mediathek-root-container.vala b/src/plugins/mediathek/rygel-mediathek-root-container.vala
index 1cb8a8c..1534565 100644
--- a/src/plugins/mediathek/rygel-mediathek-root-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-root-container.vala
@@ -23,7 +23,8 @@
using Gee;
using Soup;
-public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
+public class Rygel.Mediathek.RootContainer : Rygel.TrackableContainer,
+ Rygel.SimpleContainer {
private SessionAsync session;
private static RootContainer instance;
private static int DEFAULT_UPDATE_INTERVAL = 1800;
@@ -31,7 +32,7 @@ public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
public static RootContainer get_instance () {
if (RootContainer.instance == null) {
RootContainer.instance = new RootContainer ();
- RootContainer.instance.init ();
+ RootContainer.instance.init.begin ();
}
return instance;
@@ -46,7 +47,7 @@ public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
this.session = new Soup.SessionAsync ();
}
- private void init () {
+ private async void init () {
Gee.ArrayList<int> feeds = null;
int update_interval = DEFAULT_UPDATE_INTERVAL;
@@ -72,7 +73,7 @@ public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
}
foreach (int id in feeds) {
- this.add_child_container (new RssContainer (this, id));
+ yield this.add_child_tracked (new RssContainer (this, id));
}
Timeout.add_seconds (update_interval, () => {
@@ -85,4 +86,8 @@ public class Rygel.Mediathek.RootContainer : Rygel.SimpleContainer {
return true;
});
}
+
+ public async void add_child (MediaObject object) {
+ this.add_child_container (object as MediaContainer);
+ }
}
diff --git a/src/plugins/mediathek/rygel-mediathek-rss-container.vala b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
index b546b4f..5fa24bb 100644
--- a/src/plugins/mediathek/rygel-mediathek-rss-container.vala
+++ b/src/plugins/mediathek/rygel-mediathek-rss-container.vala
@@ -24,7 +24,8 @@ using Gee;
using Soup;
using Xml;
-public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
+public class Rygel.Mediathek.RssContainer : Rygel.TrackableContainer,
+ Rygel.SimpleContainer {
private const string URI_TEMPLATE = "http://www.zdf.de/ZDFmediathek/" +
"content/%u?view=rss";
private uint content_id;
@@ -103,14 +104,14 @@ public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
return false;
}
- this.children.clear ();
+ yield this.clear ();
this.child_count = 0;
for (int i = 0; i < xpath_object->nodesetval->length (); i++) {
var node = xpath_object->nodesetval->item (i);
try {
var item = yield factory.create (this, node);
if (item != null) {
- this.add_child_item (item);
+ yield this.add_child_tracked (item);
}
} catch (VideoItemError error) {
debug ("Could not create video item: %s, skipping",
@@ -119,7 +120,6 @@ public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
}
xpath_free_object (xpath_object);
- this.updated ();
return this.child_count > 0;
}
@@ -135,4 +135,8 @@ public class Rygel.Mediathek.RssContainer : Rygel.SimpleContainer {
return message;
}
+
+ public async void add_child (MediaObject object) {
+ this.add_child_item (object as MediaItem);
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]