[rygel/wip/track-changes: 17/21] wip: Add trackable item properties



commit a2c31b17db5627e94e5cb3650aa5c6a7239a3a67
Author: Jens Georg <jensg openismus com>
Date:   Sun Oct 21 18:58:18 2012 +0200

    wip: Add trackable item properties

 src/librygel-server/filelist.am                    |    1 +
 src/librygel-server/rygel-media-item.vala          |   11 ++++++++
 src/librygel-server/rygel-trackable-item.vala      |   27 ++++++++++++++++++++
 .../rygel-mediathek-video-item-factory.vala        |    7 +++++
 4 files changed, 46 insertions(+), 0 deletions(-)
---
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index a59bd45..d96fe7e 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -19,6 +19,7 @@ LIBRYGEL_SERVER_VAPI_SOURCE_FILES = \
 	rygel-search-expression.vala \
 	rygel-searchable-container.vala \
 	rygel-trackable-container.vala \
+	rygel-trackable-item.vala \
 	rygel-transcode-manager.vala \
 	rygel-transcoder.vala \
 	rygel-visual-item.vala \
diff --git a/src/librygel-server/rygel-media-item.vala b/src/librygel-server/rygel-media-item.vala
index 82200d9..fc02e60 100644
--- a/src/librygel-server/rygel-media-item.vala
+++ b/src/librygel-server/rygel-media-item.vala
@@ -157,6 +157,13 @@ public abstract class Rygel.MediaItem : MediaObject {
             res.import_uri = import_uri;
         }
 
+        if (this is TrackableItem) {
+            // This is attribute is mandatory for track changes
+            // implementation. We don't really support updating the resources
+            // so we just set it to 0.
+            res.update_count = 0;
+        }
+
         res.size64 = this.size;
 
         /* Protocol info */
@@ -216,6 +223,10 @@ public abstract class Rygel.MediaItem : MediaObject {
             didl_item.description = this.description;
         }
 
+        if (this is TrackableItem) {
+            didl_item.update_id = this.object_update_id;
+        }
+
         /* We list proxy/transcoding resources first instead of original URIs
          * because some crappy MediaRenderer/ControlPoint implemenation out
          * there just choose the first one in the list instead of the one they
diff --git a/src/librygel-server/rygel-trackable-item.vala b/src/librygel-server/rygel-trackable-item.vala
new file mode 100644
index 0000000..9b11429
--- /dev/null
+++ b/src/librygel-server/rygel-trackable-item.vala
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Author: Jens Georg <jensg openismus come
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+public interface Rygel.TrackableItem : Rygel.MediaItem {
+    public void changed () {
+        if (this.parent != null) {
+            this.parent.updated (this);
+        }
+    }
+}
diff --git a/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala b/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala
index d5aeea4..160dcd3 100644
--- a/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala
+++ b/src/plugins/mediathek/rygel-mediathek-video-item-factory.vala
@@ -25,6 +25,13 @@ internal errordomain Rygel.Mediathek.VideoItemError {
     NETWORK_ERROR
 }
 
+internal class Rygel.Mediathek.VideoItem : Rygel.TrackableItem,
+                                           Rygel.VideoItem {
+    public VideoItem (string id, MediaContainer parent, string title) {
+        base (id, parent, title);
+    }
+}
+
 internal class Rygel.Mediathek.VideoItemFactory : Object {
     private static VideoItemFactory instance;
     private PlaylistParser playlist_parser;



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