[rygel] media-export: Restore various update ids



commit 402b5991ae94aa31d9bd58120660d582bfc47ef8
Author: Jens Georg <jensg openismus com>
Date:   Tue Dec 11 21:37:21 2012 +0100

    media-export: Restore various update ids

 .../rygel-media-export-dummy-container.vala        |   10 +++++++
 .../rygel-media-export-media-cache.vala            |   27 ++++++++++++++++++++
 2 files changed, 37 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/media-export/rygel-media-export-dummy-container.vala b/src/plugins/media-export/rygel-media-export-dummy-container.vala
index 4e2f29f..7942eb8 100644
--- a/src/plugins/media-export/rygel-media-export-dummy-container.vala
+++ b/src/plugins/media-export/rygel-media-export-dummy-container.vala
@@ -31,6 +31,16 @@ internal class Rygel.MediaExport.DummyContainer : TrackableDbContainer {
         } catch (Error error) { }
 
         base (cache, MediaCache.get_id (file), file.get_basename ());
+
+        uint32 object_update_id, container_update_id, total_deleted_child_count;
+        this.media_db.get_track_properties (this.id,
+                                            out object_update_id,
+                                            out container_update_id,
+                                            out total_deleted_child_count);
+        this.object_update_id = object_update_id;
+        this.update_id = container_update_id;
+        this.total_deleted_child_count = total_deleted_child_count;
+
         this.parent_ref = parent;
         this.file = file;
         this.uris.add (file.get_uri ());
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 8ba7c7d..732cce5 100644
--- a/src/plugins/media-export/rygel-media-export-media-cache.vala
+++ b/src/plugins/media-export/rygel-media-export-media-cache.vala
@@ -163,6 +163,33 @@ public class Rygel.MediaExport.MediaCache : Object {
         return 0;
     }
 
+    public void get_track_properties (string id,
+                                      out uint32 object_update_id,
+                                      out uint32 container_update_id,
+                                      out uint32 total_deleted_child_count) {
+        GLib.Value[] values = { id };
+
+        object_update_id = 0;
+        container_update_id = 0;
+        total_deleted_child_count = 0;
+
+        try {
+            var cursor = this.db.exec_cursor ("SELECT object_update_id, " +
+                                              "container_update_id, " +
+                                              "deleted_child_count " +
+                                              "FROM Object WHERE upnp_id = ?",
+                                              values);
+            var statement = cursor.next ();
+            object_update_id = (uint32) statement->column_int64 (0);
+            container_update_id = (uint32) statement->column_int64 (1);
+            total_deleted_child_count = (uint32) statement->column_int64 (2);
+
+            return;
+        } catch (Error error) {
+            warning ("Failed to get update ids: %s", error.message);
+        }
+
+    }
 
     public bool exists (File      file,
                         out int64 timestamp,



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