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



commit a8521bbf0cf52e17191fdf75c0f730a00a501494
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 92da986..5ef75dc 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>
  *
@@ -829,6 +830,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;
@@ -942,7 +944,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 8bc8fff..1affd3f 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 {
@@ -112,7 +113,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 +
@@ -218,7 +219,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]