[rygel/wip/create-reference: 7/10] WIP



commit e7823feb5feaa2098bd9fbe56e479ce27d4eaeca
Author: Jens Georg <jensg openismus com>
Date:   Wed Mar 6 16:32:31 2013 +0100

    WIP

 .../rygel-media-export-media-cache.vala            |    4 +++-
 .../rygel-media-export-playlist-container.vala     |    7 ++++++-
 .../rygel-media-export-sql-factory.vala            |    8 +++++---
 3 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-media-cache.vala 
b/src/plugins/media-export/rygel-media-export-media-cache.vala
index e904cca..871ec9c 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2009,2010 Jens Georg <mail jensge org>.
+ * Copyright (C) 2013 Intel Corporation.
  *
  * Author: Jens Georg <mail jensge org>
  *
@@ -836,6 +837,7 @@ public class Rygel.MediaExport.MediaCache : Object {
             }
             object.object_update_id = (uint) statement.column_int64
                                         (DetailColumn.OBJECT_UPDATE_ID);
+            object.ref_id = statement.column_text (DetailColumn.REFERENCE_ID);
         }
 
         return object;
@@ -949,7 +951,7 @@ public class Rygel.MediaExport.MediaCache : Object {
                 column = "m.duration";
                 break;
             case "@refID":
-                column = "NULL";
+                column = "o.reference_id";
                 break;
             case "@id":
                 column = "o.upnp_id";
diff --git a/src/plugins/media-export/rygel-media-export-playlist-container.vala 
b/src/plugins/media-export/rygel-media-export-playlist-container.vala
index 787dce0..3947508 100644
--- a/src/plugins/media-export/rygel-media-export-playlist-container.vala
+++ b/src/plugins/media-export/rygel-media-export-playlist-container.vala
@@ -37,7 +37,12 @@ internal class Rygel.MediaExport.PlaylistContainer : DBContainer,
         }
 
         object.parent = this;
-        object.ref_id = object.id;
+
+        // If the original is already a ref_id, point to the original item as
+        // we should not daisy-chain reference items.
+        if (object.ref_id == null) {
+            object.ref_id = object.id;
+        }
         object.id = UUID.get ();
 
         var cache = MediaCache.get_default ();
diff --git a/src/plugins/media-export/rygel-media-export-sql-factory.vala 
b/src/plugins/media-export/rygel-media-export-sql-factory.vala
index 42b6201..020158a 100644
--- a/src/plugins/media-export/rygel-media-export-sql-factory.vala
+++ b/src/plugins/media-export/rygel-media-export-sql-factory.vala
@@ -47,7 +47,8 @@ internal enum Rygel.MediaExport.DetailColumn {
     DISC,
     OBJECT_UPDATE_ID,
     DELETED_CHILD_COUNT,
-    CONTAINER_UPDATE_ID
+    CONTAINER_UPDATE_ID,
+    REFERENCE_ID
 }
 
 internal enum Rygel.MediaExport.SQLString {
@@ -117,7 +118,7 @@ internal class Rygel.MediaExport.SQLFactory : Object {
     "m.sample_freq, m.bits_per_sample, m.channels, m.track, " +
     "m.color_depth, m.duration, o.upnp_id, o.parent, o.timestamp, " +
     "o.uri, m.dlna_profile, m.genre, m.disc, o.object_update_id, " +
-    "o.deleted_child_count, o.container_update_id ";
+    "o.deleted_child_count, o.container_update_id, o.reference_id ";
 
     private const string GET_OBJECT_WITH_PATH =
     "SELECT DISTINCT " + ALL_DETAILS_STRING +
@@ -223,7 +224,8 @@ internal class Rygel.MediaExport.SQLFactory : Object {
                           "object_update_id INTEGER, " +
                           "deleted_child_count INTEGER, " +
                           "container_update_id INTEGER, " +
-                          "is_guarded INTEGER);" +
+                          "is_guarded INTEGER, " +
+                          "reference_id TEXT DEFAULT NULL);" +
     "INSERT INTO schema_info (version) VALUES ('" +
     SQLFactory.SCHEMA_VERSION + "'); ";
 


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