rygel r486 - trunk/src/plugins/tracker
- From: zeeshanak svn gnome org
- To: svn-commits-list gnome org
- Subject: rygel r486 - trunk/src/plugins/tracker
- Date: Wed, 28 Jan 2009 12:32:39 +0000 (UTC)
Author: zeeshanak
Date: Wed Jan 28 12:32:38 2009
New Revision: 486
URL: http://svn.gnome.org/viewvc/rygel?rev=486&view=rev
Log:
Separate out search and serialization in Tracker plugin.
Modified:
trunk/src/plugins/tracker/rygel-media-tracker.vala
Modified: trunk/src/plugins/tracker/rygel-media-tracker.vala
==============================================================================
--- trunk/src/plugins/tracker/rygel-media-tracker.vala (original)
+++ trunk/src/plugins/tracker/rygel-media-tracker.vala Wed Jan 28 12:32:38 2009
@@ -109,29 +109,8 @@
public override void add_metadata (DIDLLiteWriter didl_writer,
BrowseArgs args) throws GLib.Error {
- bool found = false;
-
- TrackerContainer container;
-
- /* First try containers */
- container = find_container_by_id (args.object_id);
-
- if (container != null) {
- container.serialize (didl_writer);
-
- found = true;
- } else {
- /* Now try items */
- container = get_item_parent (args.object_id);
-
- if (container != null)
- found = container.add_item_from_db (didl_writer,
- args.object_id);
- }
-
- if (!found) {
- throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
- }
+ MediaObject media_object = find_object_by_id (args.object_id);
+ media_object.serialize (didl_writer);
args.update_id = uint32.MAX;
}
@@ -210,5 +189,24 @@
max_count,
out child_count);
}
+
+ private MediaObject find_object_by_id (string object_id) throws GLib.Error {
+ /* First try containers */
+ MediaObject media_object = find_container_by_id (object_id);
+
+ if (media_object == null) {
+ /* Now try items */
+ var container = get_item_parent (object_id);
+
+ if (container != null)
+ media_object = container.get_item_from_db (object_id);
+ }
+
+ if (media_object == null) {
+ throw new ContentDirectoryError.NO_SUCH_OBJECT ("No such object");
+ }
+
+ return media_object;
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]