Re: Expose container type to external plugin (MediaServer2 dbus interface)



Jens,

Sorry to come back to this ancient thread.
After leaving my project for a while, I've come back to it, determined to find a solution to my problem.

Technically the client requests the sort-order and we have to fall-back
to something if it doesn't.

Do we really have to fall back to a default for an external plugin?

I've had a look at the current rygel code and found:

rygel-browse.vala, handle_children_request() [114]:
        var sort_criteria = this.sort_criteria ?? container.sort_criteria;

If there's no sort_criteria set in the MediaQueryAction, the sort_criteria is set to the sort_criteria of the container, which defaults to

rygel-media-container.vala [126]:
    public string sort_criteria { set; get; default = DEFAULT_SORT_CRITERIA; }

which is:

rygel-media-container.vala [72]:
    private const string DEFAULT_SORT_CRITERIA = "+upnp:class,+dc:title";

However, at least for the external container, the sort_criteria is used in an additional operation:

rygel-external-container.vala, get_children() [101]:
        result.sort_by_criteria (sort_criteria);

sort_by_criteria always applies a sort. Either the one requested by the client (wanted) or the default one (not necessarily wanted).

Wouldn't it be better behaviour if a client doesn't request a specific sort order to return the one that originated from the server?

I suppose

diff --git a/src/plugins/external/rygel-external-dummy-container.vala b/src/plug
index b1ba379..7023dd7 100644
--- a/src/plugins/external/rygel-external-dummy-container.vala
+++ b/src/plugins/external/rygel-external-dummy-container.vala
@@ -36,6 +36,7 @@ internal class Rygel.External.DummyContainer : MediaContainer
                            uint            child_count,
                            MediaContainer? parent) {
         base (id, parent, title, (int) child_count);
+        this.sort_criteria = "";
     }

     public override async MediaObjects? get_children (

could maybe be enough to achieve that?




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