[rygel] core,tracker: Set @refID



commit 8b87710e4ff9c137ece7f9bdecce57b8181ef6d7
Author: Jens Georg <mail jensge org>
Date:   Mon Jul 25 13:57:18 2011 +0200

    core,tracker: Set @refID

 .../tracker/rygel-tracker-item-factory.vala        |   13 +++++++++++++
 .../tracker/rygel-tracker-music-item-factory.vala  |    2 ++
 .../rygel-tracker-picture-item-factory.vala        |    2 ++
 .../tracker/rygel-tracker-video-item-factory.vala  |    2 ++
 src/rygel/rygel-media-item.vala                    |    5 +++++
 5 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/tracker/rygel-tracker-item-factory.vala b/src/plugins/tracker/rygel-tracker-item-factory.vala
index 5b15888..fd00cfe 100644
--- a/src/plugins/tracker/rygel-tracker-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-item-factory.vala
@@ -89,6 +89,19 @@ public abstract class Rygel.Tracker.ItemFactory {
                                       string[]        metadata)
                                       throws GLib.Error;
 
+    protected void set_ref_id (MediaItem item, string prefix) {
+        if (item.id.has_prefix (prefix)) {
+            return;
+        }
+
+        var split_id = item.id.split (",");
+        if (split_id.length != 2) {
+            return;
+        }
+
+        item.ref_id = prefix + "," + split_id[1];
+    }
+
     protected virtual void set_metadata (MediaItem item,
                                          string    uri,
                                          string[]  metadata) throws GLib.Error {
diff --git a/src/plugins/tracker/rygel-tracker-music-item-factory.vala b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
index 4283fa6..c78f6c0 100644
--- a/src/plugins/tracker/rygel-tracker-music-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-music-item-factory.vala
@@ -87,6 +87,8 @@ public class Rygel.Tracker.MusicItemFactory : ItemFactory {
                                           throws GLib.Error {
         base.set_metadata (item, uri, metadata);
 
+        this.set_ref_id (item, "AllMusic");
+
         var music = item as MusicItem;
 
         if (metadata[MusicMetadata.DURATION] != "" &&
diff --git a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
index 76ac41f..60096ce 100644
--- a/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-picture-item-factory.vala
@@ -73,6 +73,8 @@ public class Rygel.Tracker.PictureItemFactory : ItemFactory {
                                           throws GLib.Error {
         base.set_metadata (item, uri, metadata);
 
+        this.set_ref_id (item, "AllPictures");
+
         var photo = item as PhotoItem;
 
         if (metadata[PictureMetadata.WIDTH] != "") {
diff --git a/src/plugins/tracker/rygel-tracker-video-item-factory.vala b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
index 0e5a8e5..f4f2555 100644
--- a/src/plugins/tracker/rygel-tracker-video-item-factory.vala
+++ b/src/plugins/tracker/rygel-tracker-video-item-factory.vala
@@ -75,6 +75,8 @@ public class Rygel.Tracker.VideoItemFactory : ItemFactory {
                                           throws GLib.Error {
         base.set_metadata (item, uri, metadata);
 
+        this.set_ref_id (item, "AllVideos");
+
         var video = item as VideoItem;
 
         if (metadata[VideoMetadata.WIDTH] != "")
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index 9561b05..dd3ddcf 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -175,6 +175,11 @@ public abstract class Rygel.MediaItem : MediaObject {
         var didl_item = writer.add_item ();
 
         didl_item.id = this.id;
+
+        if (this.ref_id != null) {
+            didl_item.ref_id = this.ref_id;
+        }
+
         if (this.parent != null) {
             didl_item.parent_id = this.parent.id;
         } else {



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