public bool Stop() { XBMCProto.JSONParser json = new XBMCProto.JSONParser("Player.Stop", mClnt); json.AddParameter("playerid", 0); string status = json.Execute_Str(); json = new XBMCProto.JSONParser("Player.Stop", mClnt); json.AddParameter("playerid", 1); status = json.Execute_Str(); json = new XBMCProto.JSONParser("Player.Stop", mClnt); json.AddParameter("playerid", 2); status = json.Execute_Str(); if (status == "OK") return true; return false; }
public bool PlayMovie(int movieid, bool resumeIfPossible) { if (movieid <= 0) { Form1.updateLog("ERR: Couldn't find episode", ELogLevel.Error, ELogType.XBMC); return false; } XBMCProto.JSONParser json = new XBMCProto.JSONParser("Player.Open", mClnt); json.AddParameter("item", "\"movieid\":" + movieid.ToString(), "object"); string status = json.Execute_Str(); if (status == "OK") return true; return false; }
public bool PlayTV(int tvshowid, int season, int episode, bool resumeIfPossible) { //find episodeid List<XBMCProto.Episode> eps = ListEpisodes(tvshowid, season); if (eps == null) return false; int episodeid = -1; Regex reg_se = new Regex(@"[sS](\d+)[eE](\d+)"); Regex reg_x = new Regex(@"(\d+)x(\d+)"); foreach (XBMCProto.Episode e in eps) { string s_ep = e.label; Match m = reg_se.Match(s_ep); if (m.Success) { int epnum = -1; if (Int32.TryParse(m.Groups[2].Value, out epnum)) { if (epnum == episode) episodeid = e.episodeid; } else { Form1.updateLog("ERR: Failed to parse episode from: " + m.Groups[2].Value, ELogLevel.Error, ELogType.XBMC | ELogType.SpeechRecog); } } else { m = reg_x.Match(s_ep); if (m.Success) { int epnum = -1; if (Int32.TryParse(m.Groups[2].Value, out epnum)) { if (epnum == episode) episodeid = e.episodeid; } else { Form1.updateLog("ERR: Failed to parse episode from: " + m.Groups[2].Value, ELogLevel.Error, ELogType.XBMC | ELogType.SpeechRecog); } } else { Form1.updateLog("ERR: Ep format unknown: " + s_ep, ELogLevel.Error, ELogType.XBMC | ELogType.SpeechRecog); } } if (episodeid != -1) break; } if (episodeid == -1) { Form1.updateLog("ERR: Couldn't find episode", ELogLevel.Error, ELogType.XBMC); return false; } XBMCProto.JSONParser json = new XBMCProto.JSONParser("Player.Open", mClnt); json.AddParameter("item", "\"episodeid\":"+episodeid.ToString(), "object"); if (resumeIfPossible) json.AddParameter("resume", true); string status = json.Execute_Str(); if (status == "OK") return true; return false; }
public bool Pause() { XBMCProto.JSONParser json = new XBMCProto.JSONParser("Player.PlayPause", mClnt); json.AddParameter("playerid", 1); string status = json.Execute_None(); if (status == "OK") return true; return false; }
public bool PlayGenre(int genreid) { if (genreid <= 0) { Form1.updateLog("ERR: Couldn't find genre", ELogLevel.Error, ELogType.XBMC); return false; } XBMCProto.JSONParser json = new XBMCProto.JSONParser("Player.Open", mClnt); json.AddParameter("item", "\"genreid\":" + genreid.ToString(), "object"); string status = json.Execute_Str(); if (status == "OK") return true; return false; }
public List<XBMCProto.TVShow> ListTVShows() { XBMCProto.JSONParser json = new XBMCProto.JSONParser("VideoLibrary.GetTVShows", mClnt); XBMCProto.JSONRPCQueryResultRes jres = json.Execute_Obj(); if (jres == null) return null; return jres.tvshows; }
public List<XBMCProto.Season> ListSeasons(int tvshowid) { XBMCProto.JSONParser json = new XBMCProto.JSONParser("VideoLibrary.GetSeasons", mClnt); json.AddParameter("tvshowid", tvshowid); XBMCProto.JSONRPCQueryResultRes jres = json.Execute_Obj(); if (jres == null) return null; return jres.seasons; }
public List<XBMCProto.Movie> ListMovies() { XBMCProto.JSONParser json = new XBMCProto.JSONParser("VideoLibrary.GetMovies", mClnt); XBMCProto.JSONRPCQueryResultRes jres = json.Execute_Obj(); if (jres == null) return null; return jres.movies; }
public List<XBMCProto.Episode> ListEpisodes(int tvshowid, int seasonidx) { XBMCProto.JSONParser json = new XBMCProto.JSONParser("VideoLibrary.GetEpisodes", mClnt); json.AddParameter("tvshowid", tvshowid); json.AddParameter("season", seasonidx); XBMCProto.JSONRPCQueryResultRes jres = json.Execute_Obj(); if (jres == null) return null; return jres.episodes; }
public List<XBMCProto.Genre> ListAudioGenres() { XBMCProto.JSONParser json = new XBMCProto.JSONParser("AudioLibrary.GetGenres", mClnt); XBMCProto.JSONRPCQueryResultRes jres = json.Execute_Obj(); if (jres == null) return null; return jres.genres; }