private string service_reset_token;
+ private string search_caps;
+
public override void constructed () {
this.cancellable = new Cancellable ();
this.last_change = new LastChange ();
+ this.search_caps = RelationalExpression.CAPS;
+
+ if (PluginCapabilities.TRACK_CHANGES in plugin.capabilities) {
+ this.search_caps += ",upnp:objectUpdateID,upnp:containerUpdateID";
+ }
+
this.feature_list =
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
"<Features xmlns=\"urn:schemas-upnp-org:av:avs\" " +
return this.compare_string (media_object.upnp_class);
case "dc:title":
return this.compare_string (media_object.title);
+ case "upnp:objectUpdateID":
+ if (this.op == SearchCriteriaOp.EXISTS) {
+ if (this.operand2 == "true") {
+ return media_object is TrackableContainer ||
+ media_object is TrackableItem;
+ } else {
+ return !(media_object is TrackableContainer ||
+ media_object is TrackableItem);
+ }
+ } else {
+ return this.compare_uint (media_object.object_update_id);
+ }
+ case "upnp:containerUpdateID":
+ if (!(media_object is MediaContainer)) {
+ return false;
+ }
+
+ if (this.op == SearchCriteriaOp.EXISTS) {
+ if (this.operand2 == "true") {
+ return media_object is TrackableContainer;
+ } else {
+ return !(media_object is TrackableContainer);
+ }
+ } else {
+ var container = media_object as MediaContainer;
+ return this.compare_uint (container.update_id);
+ }
case "upnp:createClass":
if (!(media_object is WritableContainer)) {
return false;
return false;
}
}
+
+ public bool compare_uint (uint integer) {
+ var operand2 = uint64.parse (this.operand2);
+
+ switch (this.op) {
+ case SearchCriteriaOp.EQ:
+ return integer == operand2;
+ case SearchCriteriaOp.NEQ:
+ return integer != operand2;
+ case SearchCriteriaOp.LESS:
+ return integer < operand2;
+ case SearchCriteriaOp.LEQ:
+ return integer <= operand2;
+ case SearchCriteriaOp.GREATER:
+ return integer > operand2;
+ case SearchCriteriaOp.GEQ:
+ return integer >= operand2;
+ default:
+ return false;
+ }
+ }
}
public string title;
public GUPnP.OCMFlags ocm_flags;
public Gee.ArrayList<string> uris;
+ public uint object_update_id;
public void add_uri (string uri) {
this.uris.add (uri);
}
}
+public interface Rygel.TrackableContainer : Rygel.MediaContainer {
+}
+
+public interface Rygel.TrackableItem : Rygel.MediaItem {
+}
+
public class Rygel.MediaItem : Rygel.MediaObject {
public string dlna_profile;
public string mime_type;
public Gee.ArrayList<string> create_classes = new Gee.ArrayList<string> ();
public int child_count;
public string sort_criteria = "+dc:title";
+ public uint update_id;
// mockable elements
public MediaObject found_object = null;