コード例 #1
0
        public GetItemsResponse GetItems(int playlistid = 0, XBMCRPC.List.Fields.All properties = null, XBMCRPC.List.Limits limits = null, XBMCRPC.List.Sort sort = null)
        {
            var jArgs = new JObject();

            if (playlistid != null)
            {
                var jpropplaylistid = JToken.FromObject(playlistid, _client.Serializer);
                jArgs.Add(new JProperty("playlistid", jpropplaylistid));
            }
            if (properties != null)
            {
                var jpropproperties = JToken.FromObject(properties, _client.Serializer);
                jArgs.Add(new JProperty("properties", jpropproperties));
            }
            if (limits != null)
            {
                var jproplimits = JToken.FromObject(limits, _client.Serializer);
                jArgs.Add(new JProperty("limits", jproplimits));
            }
            if (sort != null)
            {
                var jpropsort = JToken.FromObject(sort, _client.Serializer);
                jArgs.Add(new JProperty("sort", jpropsort));
            }
            var jRet = _client.GetData <GetItemsResponse>("Playlist.GetItems", jArgs);

            return(jRet);
        }
コード例 #2
0
        /// <summary>
        /// Retrieves the currently played item
        /// </summary>
        public async Task <XBMCRPC.Player.GetItemResponse> GetItem(int playerid = 0, XBMCRPC.List.Fields.All properties = null)
        {
            var jArgs = new JObject();

            if (playerid != null)
            {
                var jpropplayerid = JToken.FromObject(playerid, _client.Serializer);
                jArgs.Add(new JProperty("playerid", jpropplayerid));
            }
            if (properties != null)
            {
                var jpropproperties = JToken.FromObject(properties, _client.Serializer);
                jArgs.Add(new JProperty("properties", jpropproperties));
            }
            return(await _client.GetData <XBMCRPC.Player.GetItemResponse>("Player.GetItem", jArgs));
        }