Example #1
0
        /// <summary>
        /// Get details for a specific file
        /// </summary>
        /// <param name="file"> REQUIRED Full path to the file</param>
        /// <param name="media"> </param>
        /// <param name="properties"> </param>
        /// <returns>KodiRpc.Files.GetFileDetailsResponse</returns>
        public async Task <KodiRpc.Files.GetFileDetailsResponse> GetFileDetails(string file = null, KodiRpc.Files.Media?media = null, KodiRpc.List.Fields.Files properties = null)
        {
            var jArgs = new JObject();

            if (file == null)
            {
                throw new global::System.ArgumentException("Parameter cannot be null file");
            }
            else
            {
                var jpropfile = JToken.FromObject(file, _client.Serializer);
                jArgs.Add(new JProperty("file", jpropfile));
            }
            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));
            }
            return(await _client.GetData <KodiRpc.Files.GetFileDetailsResponse>("Files.GetFileDetails", jArgs));
        }
Example #2
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));
        }