Пример #1
0
        internal DACPRequest GetPlayQueueEditRequest(string command, DACPQueryElement query, PlayQueueMode mode, string sort = null)
        {
            DACPRequest request = new DACPRequest("/ctrl-int/1/playqueue-edit");

            request.QueryParameters["command"] = command;
            if (query != null)
            {
                request.QueryParameters["query"] = query.ToString();
            }
            request.QueryParameters["mode"] = ((int)mode).ToString();
            if (sort != null)
            {
                request.QueryParameters["sort"] = sort;
            }

            if (this != Server.MainDatabase)
            {
                request.QueryParameters["srcdatabase"] = "0x" + PersistentID.ToString("x16");
            }

            // TODO: Handle this separately
            if (mode == PlayQueueMode.Replace)
            {
                request.QueryParameters["clear-previous"] = "1";
            }

            return(request);
        }
Пример #2
0
        internal DACPRequest GetComposersRequest(bool requestSortHeaders = false)
        {
            DACPRequest      request = new DACPRequest("/databases/{0}/browse/composers", Database.ID);
            DACPQueryElement query   = DACPQueryCollection.And(DACPQueryPredicate.IsNotEmpty("daap.songcomposer"), MediaKindQuery);

            request.QueryParameters["filter"] = query.ToString();
            if (requestSortHeaders)
            {
                request.QueryParameters["include-sort-headers"] = "1";
            }
            return(request);
        }
Пример #3
0
        private DACPRequest GetCueRequest(DACPQueryElement query, string sort)
        {
            DACPRequest request = new DACPRequest("/ctrl-int/1/cue");

            request.QueryParameters["command"] = "play";
            if (query != null)
            {
                request.QueryParameters["query"] = query.ToString();
            }
            request.QueryParameters["sort"]        = sort;
            request.QueryParameters["srcdatabase"] = "0x" + PersistentID.ToString("x16");
            request.QueryParameters["clear-first"] = "1";

            return(request);
        }
Пример #4
0
        internal DACPRequest GetItemsRequest(DACPQueryElement query, string sort = "album", bool requestSortHeaders = false)
        {
            // Apple's Remote uses the Base Playlist ID here rather than the actual container ID.
            DACPRequest request = new DACPRequest("/databases/{0}/containers/{1}/items", Database.ID, Database.BasePlaylist.ID);

            request.QueryParameters["meta"] = ItemsMeta;
            request.QueryParameters["type"] = "music";
            request.QueryParameters["sort"] = sort;
            if (requestSortHeaders)
            {
                request.QueryParameters["include-sort-headers"] = "1";
            }
            if (query != null)
            {
                request.QueryParameters["query"] = query.ToString();
            }

            return(request);
        }
Пример #5
0
        internal DACPRequest GetGroupsRequest(DACPQueryElement query, bool includeSortHeaders = false, string groupType = "albums")
        {
            DACPRequest request = new DACPRequest("/databases/{0}/groups", Database.ID);

            request.QueryParameters["meta"]       = GroupsMeta;
            request.QueryParameters["type"]       = "music";
            request.QueryParameters["group-type"] = groupType;
            if (includeSortHeaders)
            {
                request.QueryParameters["include-sort-headers"] = "1";
            }
            request.QueryParameters["sort"] = "album";
            if (query != null)
            {
                request.QueryParameters["query"] = query.ToString();
            }

            return(request);
        }