public override string ToString()
 {
     return("'" + _key + _operator + Uri.EscapeDataString(DacpUtility.EscapeSingleQuotes(_value)) + "'");
 }
Example #2
0
        public async Task <bool> SendPlayItemCommandAsync(DacpItem item, PlayQueueMode mode = PlayQueueMode.Replace)
        {
            DacpRequest request;

            if (Client.ServerSupportsPlayQueue)
            {
                request = Database.GetPlayQueueEditRequest("add", DacpQueryPredicate.Is("dmap.itemid", item.ID), mode, "name");
                request.QueryParameters["queuefilter"] = string.Format("genre:{0}", Uri.EscapeDataString(DacpUtility.EscapeSingleQuotes(Name)));
            }
            else
            {
                var items = await GetItemsAsync();

                int index = items.FindIndex(i => i.ID == item.ID);
                if (index < 0)
                {
                    return(false);
                }
                request = Database.GetCueSongRequest(DacpQueryCollection.And(GenreQuery, Container.MediaKindQuery), "name", index);
            }

            try { await Client.SendRequestAsync(request).ConfigureAwait(false); }
            catch { return(false); }
            return(true);
        }