Exemple #1
0
        public List <Movie> GetMovies(string[] fields, SortParams sort)
        {
            var args = new JObject();

            if (fields != null)
            {
                args.Add(new JProperty("fields", fields));
            }
            if (sort != null)
            {
                args.Add(sort.ToJObject().Children());
            }

            List <Movie> list  = new List <Movie>();
            JObject      query = (JObject)Client.Invoke("VideoLibrary.GetMovies", args);

            if (query["movies"] != null)
            {
                foreach (JObject item in (JArray)query["movies"])
                {
                    list.Add(Movie.MovieFromJsonObject(item));
                }
            }

            return(list);
        }
Exemple #2
0
        public void Create(string playlist)
        {
            var args = new JObject();

            args.Add(new JProperty("playlist", playlist));

            Client.Invoke("Playlist.Create", args);
        }
Exemple #3
0
        public bool IsAudioPlayerActive()
        {
            JObject query = (JObject)Client.Invoke("Player.GetActivePlayers");

            if (query["audio"] != null)
            {
                if (query["audio"].Value <JValue>().Value.ToString() == "True")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            return(false);
        }
Exemple #4
0
        public List <Share> GetSources(string media)
        {
            var args = new JObject();

            args.Add(new JProperty("media", media));

            JObject      query = (JObject)Client.Invoke("Files.GetSources", args);
            List <Share> list  = new List <Share>();

            if (query["shares"] != null)
            {
                foreach (JObject item in (JArray)query["shares"])
                {
                    list.Add(Share.ShareFromJsonObject(item));
                }
            }

            return(list);
        }
Exemple #5
0
        public List <JsonMethod> Introspect()
        {
            var args = new JObject();

            args.Add(new JProperty("getdescriptions", true));
            args.Add(new JProperty("getpermissions", true));
            args.Add(new JProperty("filterbytransport", true));

            JObject           query = (JObject)Client.Invoke("JSONRPC.Introspect", args);
            List <JsonMethod> list  = new List <JsonMethod>();

            if (query["commands"] != null)
            {
                foreach (JObject item in (JArray)query["commands"])
                {
                    list.Add(JsonMethod.JsonMethodFromJsonObject(item));
                }
            }

            return(list);
        }
Exemple #6
0
 public void Play(int playlistIndex)
 {
     Client.Invoke("AudioPlaylist.Play", playlistIndex);
 }
Exemple #7
0
 public int GetVolume()
 {
     return((int)Client.Invoke("XBMC.GetVolume"));
 }
Exemple #8
0
 public void Play()
 {
     Client.Invoke("VideoPlaylist.Play");
 }
Exemple #9
0
        public List <Artist> GetArtists(SortParams sort)
        {
            var args = new JObject();

            if (sort != null)
            {
                args.Add(sort.ToJObject().Children());
            }

            JObject       query = (JObject)Client.Invoke("AudioLibrary.GetArtists", args);
            List <Artist> list  = new List <Artist>();

            if (query != null)
            {
                foreach (JObject item in (JArray)query["artists"])
                {
                    list.Add(Artist.ArtistFromJsonObject(item));
                }
            }

            return(list);
        }
Exemple #10
0
        public bool PlayPause()
        {
            JObject query = (JObject)Client.Invoke("AudioPlayer.PlayPause");

            if (query["paused"] != null)
            {
                return((bool)query["paused"].Value <JValue>().Value);
            }
            else
            {
                return(false);
            }
        }
Exemple #11
0
        public float GetFPS()
        {
            string[] label = new string[] { "System.FPS" };
            JObject  query = (JObject)Client.Invoke("System.GetInfoLabels", label);

            if (query != null)
            {
                return((float)Convert.ToDouble(query["System.FPS"].Value <JValue>().Value));
            }
            else
            {
                return(-1);
            }
        }