Beispiel #1
0
        /// <summary>
        /// Retrieve all profiles
        /// </summary>
        /// <param name="properties"> </param>
        /// <param name="limits"> </param>
        /// <param name="sort"> </param>
        /// <returns>KodiRpc.Profiles.GetProfilesResponse</returns>
        public async Task <KodiRpc.Profiles.GetProfilesResponse> GetProfiles(KodiRpc.Profiles.Fields.Profile properties = null, KodiRpc.List.Limits limits = null, KodiRpc.List.Sort sort = null)
        {
            var jArgs = new JObject();

            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));
            }
            return(await _client.GetData <KodiRpc.Profiles.GetProfilesResponse>("Profiles.GetProfiles", jArgs));
        }
Beispiel #2
0
        /// <summary>
        /// Get the sources of the media windows
        /// </summary>
        /// <param name="media"> REQUIRED </param>
        /// <param name="limits"> </param>
        /// <param name="sort"> </param>
        /// <returns>KodiRpc.Files.GetSourcesResponse</returns>
        public async Task <KodiRpc.Files.GetSourcesResponse> GetSources(KodiRpc.Files.Media?media = null, KodiRpc.List.Limits limits = null, KodiRpc.List.Sort sort = null)
        {
            var jArgs = new JObject();

            if (media == null)
            {
                throw new global::System.ArgumentException("Parameter cannot be null media");
            }
            else
            {
                var jpropmedia = JToken.FromObject(media, _client.Serializer);
                jArgs.Add(new JProperty("media", jpropmedia));
            }
            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));
            }
            return(await _client.GetData <KodiRpc.Files.GetSourcesResponse>("Files.GetSources", jArgs));
        }
Beispiel #3
0
        /// <summary>
        /// Get the directories and files in the given directory
        /// </summary>
        /// <param name="directory"> REQUIRED </param>
        /// <param name="media"> </param>
        /// <param name="properties"> </param>
        /// <param name="sort"> </param>
        /// <param name="limits"> Limits are applied after getting the directory content thus retrieval is not faster when they are applied.</param>
        /// <returns>KodiRpc.Files.GetDirectoryResponse</returns>
        public async Task <KodiRpc.Files.GetDirectoryResponse> GetDirectory(string directory = null, KodiRpc.Files.Media?media = null, KodiRpc.List.Fields.Files properties = null, KodiRpc.List.Sort sort = null, KodiRpc.List.Limits limits = null)
        {
            var jArgs = new JObject();

            if (directory == null)
            {
                throw new global::System.ArgumentException("Parameter cannot be null directory");
            }
            else
            {
                var jpropdirectory = JToken.FromObject(directory, _client.Serializer);
                jArgs.Add(new JProperty("directory", jpropdirectory));
            }
            if (media != null)
            {
                var jpropmedia = JToken.FromObject(media, _client.Serializer);
                jArgs.Add(new JProperty("media", jpropmedia));
            }
            if (properties != null)
            {
                var jpropproperties = JToken.FromObject(properties, _client.Serializer);
                jArgs.Add(new JProperty("properties", jpropproperties));
            }
            if (sort != null)
            {
                var jpropsort = JToken.FromObject(sort, _client.Serializer);
                jArgs.Add(new JProperty("sort", jpropsort));
            }
            if (limits != null)
            {
                var jproplimits = JToken.FromObject(limits, _client.Serializer);
                jArgs.Add(new JProperty("limits", jproplimits));
            }
            return(await _client.GetData <KodiRpc.Files.GetDirectoryResponse>("Files.GetDirectory", jArgs));
        }
Beispiel #4
0
        /// <summary>
        /// Get all items from playlist
        /// </summary>
        /// <param name="playlistid"> REQUIRED </param>
        /// <param name="properties"> </param>
        /// <param name="limits"> </param>
        /// <param name="sort"> </param>
        /// <returns>KodiRpc.Playlist.GetItemsResponse</returns>
        public async Task <KodiRpc.Playlist.GetItemsResponse> GetItems(int?playlistid = null, KodiRpc.List.Fields.All properties = null, KodiRpc.List.Limits limits = null, KodiRpc.List.Sort sort = null)
        {
            var jArgs = new JObject();

            if (playlistid == null)
            {
                throw new global::System.ArgumentException("Parameter cannot be null playlistid");
            }
            else
            {
                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));
            }
            return(await _client.GetData <KodiRpc.Playlist.GetItemsResponse>("Playlist.GetItems", jArgs));
        }