コード例 #1
0
        /// <summary>
        /// Start playback of either the playlist with the given ID, a slideshow with the pictures from the given directory or a single file or an item from the database.
        /// </summary>
        public async Task <string> Open(XBMCRPC.Playlist.ItemSongid item, XBMCRPC.Player.Open_options options = null)
        {
            var jArgs = new JObject();

            if (item != null)
            {
                var jpropitem = JToken.FromObject(item, _client.Serializer);
                jArgs.Add(new JProperty("item", jpropitem));
            }
            if (options != null)
            {
                var jpropoptions = JToken.FromObject(options, _client.Serializer);
                jArgs.Add(new JProperty("options", jpropoptions));
            }
            return(await _client.GetData <string>("Player.Open", jArgs));
        }
コード例 #2
0
        /// <summary>
        /// Add item(s) to playlist
        /// </summary>
        public async Task <string> Add(XBMCRPC.Playlist.ItemSongid item, int playlistid = 0)
        {
            var jArgs = new JObject();

            if (playlistid != null)
            {
                var jpropplaylistid = JToken.FromObject(playlistid, _client.Serializer);
                jArgs.Add(new JProperty("playlistid", jpropplaylistid));
            }
            if (item != null)
            {
                var jpropitem = JToken.FromObject(item, _client.Serializer);
                jArgs.Add(new JProperty("item", jpropitem));
            }
            return(await _client.GetData <string>("Playlist.Add", jArgs));
        }