Exemple #1
0
        private List <T> GetList <T>(string Prop)
        {
            string   json = Xbmc.ExecuteJSONRPC("{'jsonrpc': '2.0', 'id': 1, 'method': 'VideoLibrary.GetTVShowDetails', 'params': {'properties': ['" + Prop + "'], 'tvshowid': " + Id + " }}");
            List <T> ret;

            if (typeof(T) == typeof(Actor))
            {
                ret = new List <T>();
                Array <PythonObject> mov = new Array <PythonObject>(json + "['result']['tvshowdetails']['" + Prop + "']");
                foreach (PythonObject m in mov)
                {
                    Actor a = new Actor();
                    a.Name      = Utils.Call <string>(m._name + ".get('name','')");
                    a.Order     = Utils.Call <int>(m._name + ".get('order',0)");
                    a.Role      = Utils.Call <string>(m._name + ".get('role','')");
                    a.Thumbnail = Utils.Call <string>(m._name + ".get('thumbnail','')");
                    ret.Add((T)(object)a);
                }
            }
            else
            {
                ret = new Array <T>(json + "['result']['tvshowdetails']['" + Prop + "']").ToList();
            }
            Utils.Call("del " + json);
            return(ret);
        }
Exemple #2
0
        public List <Season> GetSeasons(int StartIndex = 0, int Count = 0)
        {
            List <Season> Movies = new List <Season>();
            string        limit  = "";

            if (Count > 0)
            {
                limit = "'limits': { 'start' : " + StartIndex + ", 'end': " + (StartIndex + Count) + " } ";
            }
            string json = Xbmc.ExecuteJSONRPC("{'jsonrpc': '2.0', 'method': 'VideoLibrary.GetSeasons', 'params': { 'properties' : ['showtitle', 'season','episode','watchedepisodes'], 'tvshowid' : " + Id + ", " + limit + "}, 'id': 'libMovies'}");
            Array <PythonObject> mov = new Array <PythonObject>(json + "['result']['seasons']");

            foreach (PythonObject m in mov)
            {
                int    sId = Utils.Call <int>(m._name + ".get('seasonid','')");
                Season s   = new Season(sId, Id);
                s.SeasonNumber    = Utils.Call <int>(m._name + ".get('season','')");
                s.ShowTitle       = Utils.Call <string>(m._name + ".get('showtitle','')");
                s.EpisodeCount    = Utils.Call <int>(m._name + ".get('episode','')");
                s.WatchedEpisodes = Utils.Call <int>(m._name + ".get('watchedepisodes','')");
                Movies.Add(s);
            }
            Utils.Call("del " + json);
            return(Movies);
        }
Exemple #3
0
 private T Get <T>(string Prop)
 {
     if (typeof(T) == typeof(Artwork))
     {
         string  json = Xbmc.ExecuteJSONRPC("{'jsonrpc': '2.0', 'id': 1, 'method': 'VideoLibrary.GetTVShowDetails', 'params': {'properties': ['" + Prop + "'], 'tvshowid': " + Id + " }}");
         Artwork a    = new Artwork();
         a.Banner = Utils.Call <string>(json + "['result']['moviedetails']['" + Prop + "'].get('banner','')");
         a.Fanart = Utils.Call <string>(json + "['result']['moviedetails']['" + Prop + "'].get('fanart','')");
         a.Poster = Utils.Call <string>(json + "['result']['moviedetails']['" + Prop + "'].get('poster','')");
         a.Thumb  = Utils.Call <string>(json + "['result']['moviedetails']['" + Prop + "'].get('thumb','')");
         return((T)(object)a);
     }
     else
     {
         string RetIfNull = "";
         if (typeof(T) == typeof(int) || typeof(T) == typeof(float) || typeof(T) == typeof(long))
         {
             RetIfNull = "0";
         }
         else if (typeof(T) == typeof(string))
         {
             RetIfNull = "''";
         }
         else if (typeof(T) == typeof(string))
         {
             RetIfNull = false.ToString();
         }
         return(Utils.Call <T>("json.loads(xbmc.executeJSONRPC(json.dumps({'jsonrpc': '2.0', 'id': 1, 'method': 'VideoLibrary.GetTVShowDetails', 'params': {'properties': ['" + Prop + "'], 'tvshowid': " + Id + " }})))['result']['tvshowdetails'].get('" + Prop + "'," + RetIfNull + ")"));
     }
 }
Exemple #4
0
        public List <TVShow> GetTVShows(int StartIndex = 0, int Count = 0)
        {
            List <TVShow> Movies = new List <TVShow>();
            string        limit  = "";

            if (Count > 0)
            {
                limit = "'params': { 'limits': { 'start' : " + StartIndex + ", 'end': " + (StartIndex + Count) + " }}, ";
            }
            string json = Xbmc.ExecuteJSONRPC("{'jsonrpc': '2.0', 'method': 'VideoLibrary.GetTVShows', " + limit + "'id': 'libTVShows'}");
            Array <PythonObject> mov = new Array <PythonObject>(json + "['result']['tvshows']");

            foreach (PythonObject m in mov)
            {
                int    id  = Utils.Call <int>(m._name + ".get('tvshowid',0)");
                string lab = Utils.Call <string>(m._name + ".get('label','')");
                Movies.Add(new TVShow(id, lab));
            }
            Utils.Call("del " + json);
            return(Movies);
        }
Exemple #5
0
        public List <Episode> GetEpisodes(int StartIndex = 0, int Count = 0)
        {
            List <Episode> Ep    = new List <Episode>();
            string         limit = "";

            if (Count > 0)
            {
                limit = "'limits': { 'start' : " + StartIndex + ", 'end': " + (StartIndex + Count) + " } ";
            }
            string json = Xbmc.ExecuteJSONRPC("{'jsonrpc': '2.0', 'method': 'VideoLibrary.GetEpisodes', 'params': { 'tvshowid' : " + TvShowId + ", 'season' : " + SeasonNumber + ", " + limit + "}, 'id': 'libMovies'}");
            Array <PythonObject> mov = new Array <PythonObject>(json + "['result']['episodes']");

            foreach (PythonObject m in mov)
            {
                int    id    = Utils.Call <int>(m._name + ".get('episodeid',0)");
                string label = Utils.Call <string>(m._name + ".get('label','')");
                Ep.Add(new Episode(id, label, Id, TvShowId));
            }
            Utils.Call("del " + json);
            return(Ep);
        }