public void PlayTvEpisode(ApiTvEpisode tvepisode) { if (tvepisode == null) return; if (!_parent.IsConnected()) return; EmbyPlayPlayList(tvepisode.Path); _parent.Log("Attemping to Play IdEpsiode equals: " + tvepisode.Path); /* var args = new JsonObject(); var items = new JsonObject(); args["episodeid"] = tvepisode.IdEpisode; items["item"] = args; items["playlistid"] = 1; var plId = new JsonObject(); plId["playlistid"] = 1; var item = new JsonObject(); item["item"] = plId; _parent.JsonCommand("Playlist.Clear", plId); _parent.JsonCommand("Playlist.Add", items); _parent.JsonCommand("Player.Open", item); */ }
public void PlayTvEpisode(ApiTvEpisode tvepisode) { if (tvepisode == null) return; if (!_parent.IsConnected()) return; _parent.AsyncIPimpCommand(new CommandInfoIPimp { Action = "playepisode", Value = tvepisode.Path, Tracks = "no" }); }
public void PlayTvEpisode(ApiTvEpisode tvepisode) { if (tvepisode == null) return; if (!_parent.IsConnected()) return; var file = (tvepisode.IsStack != 1) ? tvepisode.Path + tvepisode.FileName : tvepisode.FileName; _parent.AsyncCommand("PlayFile", file); }
public void PlayTvEpisode(ApiTvEpisode tvepisode) { if (tvepisode == null) return; if (!_parent.IsConnected()) return; var args = new JsonObject(); args["episodeid"] = tvepisode.IdEpisode; _parent.AsyncJsonCommand("XBMC.Play", args); }
public void PlayTvEpisode(ApiTvEpisode tvepisode) { if (tvepisode == null) return; if (!_parent.IsConnected()) return; var args = new JsonObject(); var items = new JsonObject(); args["episodeid"] = tvepisode.IdEpisode; items["item"] = args; items["playlistid"] = 1; var plId = new JsonObject(); plId["playlistid"] = 1; var item = new JsonObject(); item["item"] = plId; _parent.JsonCommand("Playlist.Clear", plId); _parent.JsonCommand("Playlist.Add", items); _parent.JsonCommand("Player.Open", item); }
public Collection<ApiTvEpisode> GetTvEpisodes() { var episodes = new Collection<ApiTvEpisode>(); const string req = "SELECT idEpisode,c00,c01,c03,c05,c10,c12,c13,idFile,strFileName,strPath,playCount,strTitle,strStudio,idShow,mpaa FROM episodeview "; var dblines = _parent.DBCommand("video", req); if (dblines == null) return episodes; foreach (var dbline in dblines) { if (dbline.Length < 15) { _parent.Log("Invalid request DATA : " + dbline); continue; } dbline[3] = dbline[3].Length > 3 ? dbline[3] : "0.0"; var episode = new ApiTvEpisode { IdEpisode = Xbmc.StringToNumber(dbline[0]), Title = dbline[1], Plot = dbline[2], Rating = dbline[3].Substring(0, 3).Trim('.'), Date = dbline[4], Director = dbline[5], Season = Xbmc.StringToNumber(dbline[6]), Episode = Xbmc.StringToNumber(dbline[7]), IdFile = Xbmc.StringToNumber(dbline[8]), FileName = dbline[9], Path = dbline[10], PlayCount = Xbmc.StringToNumber(dbline[11]), ShowTitle = dbline[12], Studio = dbline[13], IdShow = Xbmc.StringToNumber(dbline[14]), Mpaa = dbline[15] }; if (episode.FileName.StartsWith("stack://",StringComparison.OrdinalIgnoreCase)) { var temp = episode.FileName.Split(new[] { " , " }, StringSplitOptions.None); episode.IsStack = 1; episode.Hash = Xbmc.Hash(temp[0].Replace("stack://", "")); episode.Thumb = @"special://profile/Thumbnails/Video/" + episode.Hash[0] + "/" + episode.Hash + ".tbn"; episode.Fanart = @"special://profile/Thumbnails/Video/Fanart/" + Xbmc.Hash(episode.Path) + ".tbn"; } else { episode.IsStack = 0; episode.Hash = Xbmc.Hash(episode.Path + episode.FileName); episode.Thumb = @"special://profile/Thumbnails/Video/" + episode.Hash[0] + "/" + episode.Hash + ".tbn"; episode.Fanart = @"special://profile/Thumbnails/Video/Fanart/" + Xbmc.Hash(episode.Path) + ".tbn"; } episodes.Add(episode); } return episodes; }
public Collection<ApiTvEpisode> GetTvEpisodesRefresh() { var episodes = new Collection<ApiTvEpisode>(); var properties = new JsonArray(new[] { "title", "plot", "season", "episode", "showtitle", "tvshowid", "fanart", "thumbnail", "rating", "playcount", "firstaired" }); var param = new JsonObject(); param["properties"] = properties; // First 100 Date sorted var param2 = new JsonObject(); param2.Add("start", 0); param2.Add("end", 100); var param3 = new JsonObject(); param3.Add("order", "descending"); param3.Add("method", "dateadded"); param.Add("sort", param3); param.Add("limits", param2); var result = (JsonObject)_parent.JsonCommand("VideoLibrary.GetEpisodes", param); if (result != null) { if (result.Contains("episodes")) { foreach (JsonObject genre in (JsonArray)result["episodes"]) { try { var tvShow = new ApiTvEpisode { Title = genre["title"].ToString(), Plot = genre["plot"].ToString(), Rating = genre["rating"].ToString(), Mpaa = "", Date = genre["firstaired"].ToString(), Director = "", PlayCount = 0, Studio = "", IdEpisode = (long)(JsonNumber)genre["episodeid"], IdShow = (long)(JsonNumber)genre["tvshowid"], Season = (long)(JsonNumber)genre["season"], Episode = (long)(JsonNumber)genre["episode"], Path = "", ShowTitle = genre["showtitle"].ToString(), Thumb = genre["thumbnail"].ToString(), Fanart = genre["fanart"].ToString(), Hash = Xbmc.Hash(genre["thumbnail"].ToString()) }; episodes.Add(tvShow); } catch (Exception) { } } } } return episodes; }
public void PlayTvEpisode(ApiTvEpisode tvepisode) { }
public Collection<ApiTvEpisode> GetTvEpisodes() { var episodes = new Collection<ApiTvEpisode>(); if (!_parent.IsConnected()) return episodes; var dblines = _parent.IPimpDBCommand(new CommandInfoIPimp { Action = "getallepisodes" }, "episodes"); if (dblines == null) return episodes; foreach (JsonObject dbline in dblines) { var tvEpisode = new ApiTvEpisode { Fanart = (string)dbline["fanart"], Hash = MediaPortal.Hash((string)dbline["id"]), IdShow = Convert.ToInt32(dbline["idshow"], CultureInfo.InvariantCulture), Thumb = (string)dbline["thumb"], Date = (string)dbline["aired"], Director = (string)dbline["director"], Episode = Convert.ToInt32(dbline["episode"], CultureInfo.InvariantCulture), Season = Convert.ToInt32(dbline["season"], CultureInfo.InvariantCulture), FileName = (string)dbline["filename"], IdEpisode = Convert.ToInt32(dbline["id"], CultureInfo.InvariantCulture), IdFile = Convert.ToInt32(dbline["id"], CultureInfo.InvariantCulture), IsStack = 0, Mpaa = "", Path = (string)dbline["path"], PlayCount = Convert.ToInt32(dbline["watched"], CultureInfo.InvariantCulture), Plot = (string)dbline["plot"], Rating = (string)dbline["rating"], ShowTitle = (string)dbline["show"], Studio = (string)dbline["studio"], Title = (string)dbline["name"] }; episodes.Add(tvEpisode); } return episodes; }
public Yatse2TvEpisode(ApiTvEpisode apiTvEpisode) { if (apiTvEpisode == null) return; IdEpisode = apiTvEpisode.IdEpisode; IdFile = apiTvEpisode.IdFile; IdShow = apiTvEpisode.IdShow; Title = apiTvEpisode.Title; ShowTitle = apiTvEpisode.ShowTitle; Rating = apiTvEpisode.Rating; Plot = apiTvEpisode.Plot; Director = apiTvEpisode.Director; Date = apiTvEpisode.Date; Mpaa = apiTvEpisode.Mpaa; Studio = apiTvEpisode.Studio; Season = apiTvEpisode.Season; Episode = apiTvEpisode.Episode; FileName = apiTvEpisode.FileName; Path = apiTvEpisode.Path; PlayCount = apiTvEpisode.PlayCount; Hash = apiTvEpisode.Hash; Thumb = apiTvEpisode.Thumb; Fanart = apiTvEpisode.Fanart; IsStack = apiTvEpisode.IsStack; }
public ApiTvEpisode ToApi() { var api = new ApiTvEpisode { Fanart = Fanart, Hash = Hash, Thumb = Thumb, Path = Path, Title = Title, IdShow = IdShow, Mpaa = Mpaa, Plot = Plot, Rating = Rating, Studio = Studio, Date = Date, Director = Director, Episode = Episode, FileName = FileName, IdEpisode = IdEpisode, IdFile = IdFile, IsStack = IsStack, PlayCount = PlayCount, Season = Season, ShowTitle = ShowTitle, }; return api; }
/** public Collection<ApiTvSeason> GetTvSeasons() { var seasons = new Collection<ApiTvSeason>(); try { _parent.Trace("Getting TV Seasons:" + _parent.IP); string NPurl = "http://" + _parent.IP + ":" + _parent.Port + "/emby/Users/" + Globals.CurrentUserID + "/Items?Recursive=true&IncludeItemTypes=Season"; var request = WebRequest.CreateHttp(NPurl); request.Method = "get"; request.Timeout = 150000; request.KeepAlive = false; _parent.Trace("Get TVSeasons TV Season Selection: " + NPurl); var authString = _parent.GetAuthString(); request.Headers.Add("X-MediaBrowser-Token", Globals.EmbyAuthToken); request.Headers.Add("X-Emby-Authorization", authString); request.ContentType = "application/json; charset=utf-8"; request.Accept = "application/json; charset=utf-8"; var response = request.GetResponse(); if (((HttpWebResponse)response).StatusCode == HttpStatusCode.OK) { System.IO.Stream dataStream = response.GetResponseStream(); //REMOVETHIS System.IO.StreamReader reader = new System.IO.StreamReader(dataStream); using (var sr = new System.IO.StreamReader(response.GetResponseStream())) { string json = sr.ReadToEnd(); _parent.Trace("--------------GETTING Single TV Season Selection Result ------" + json); var deserializer = new JavaScriptSerializer(); deserializer.MaxJsonLength = Int32.MaxValue; var ItemData = deserializer.Deserialize<TVSeasons.Rootobject>(json); _parent.Trace("---------------Get Single TV Season Selection: Issue: Results.Taglines: " + ItemData.TotalRecordCount); foreach (var genre in ItemData.Items) { try { //var SingleTVData = GetSingleTVFromSeries(genre.Id); _parent.Trace("---Emby GetTVSeasons--- Season Number:" + (long)(int)genre.IndexNumber); _parent.Trace("---Emby GetTVSeasons--- ID Show:" + Xbmc.IDtoNumber(genre.SeriesId)); _parent.Trace("---Emby GetTVSeasons--- Series Name:" + genre.SeriesName); _parent.Trace("---Emby GetTVSeasons--- Thumb:" + "http://" + _parent.IP + ":" + _parent.Port + "/Items/" + genre.Id + "/Images/Primary" ?? ""); _parent.Trace("---Emby GetTVSeasons--- Child Count:" + (long)(int)genre.ChildCount); _parent.Trace("---Emby GetTVSeasons--- Fanart:" + "http://" + _parent.IP + ":" + _parent.Port + "/Items/" + genre.SeriesId + "/Images/Backdrop" ?? ""); _parent.Trace("---Emby GetTVSeasons--- Hash:" + Xbmc.Hash(genre.Id)); var tvShow = new ApiTvSeason { SeasonNumber = genre.IndexNumber, IdShow = Xbmc.IDtoNumber(genre.SeriesId), Show = genre.SeriesName ?? "", Thumb = "http://" + _parent.IP + ":" + _parent.Port + "/Items/" + genre.Id + "/Images/Primary" ?? "", EpisodeCount = (long)(int)genre.ChildCount, Fanart = "http://" + _parent.IP + ":" + _parent.Port + "/Items/" + genre.SeriesId + "/Images/Backdrop" ?? "", Hash = Xbmc.Hash(genre.Id) }; seasons.Add(tvShow); } catch (Exception ex) { _parent.Trace("TV Shows Exception Caught " + ex); } } } } } catch (Exception Ex) { _parent.Trace("Another tV SHows exception" + Ex); } return seasons; } **/ public Collection<ApiTvEpisode> GetTvEpisodes() { var episodes = new Collection<ApiTvEpisode>(); try { _parent.Trace("GetTVEpisodes : Parent IP: " + _parent.IP); string NPurl = "http://" + _parent.IP + ":" + _parent.Port + "/emby/Users/" + Globals.CurrentUserID + "/Items?Recursive=true&ExcludeLocationTypes=Virtual&IncludeItemTypes=Episode"; var request = WebRequest.CreateHttp(NPurl); request.Method = "get"; request.Timeout = 700000; _parent.Trace("GetTVEpisodes: Single TV Episode Selection: " + _parent.IP + ":" + _parent.Port); var authString = _parent.GetAuthString(); request.Headers.Add("X-MediaBrowser-Token", Globals.EmbyAuthToken); request.Headers.Add("X-Emby-Authorization", authString); request.ContentType = "application/json; charset=utf-8"; request.Accept = "application/json; charset=utf-8"; var response = request.GetResponse(); if (((HttpWebResponse)response).StatusCode == HttpStatusCode.OK) { System.IO.Stream dataStream = response.GetResponseStream(); using (var sr = new System.IO.StreamReader(response.GetResponseStream())) { string json = sr.ReadToEnd(); _parent.Trace("--------------GETTING TVEpisodes Selection Result ------" + json + "---END---"); var deserializer = new JavaScriptSerializer(); deserializer.MaxJsonLength = Int32.MaxValue; var ItemData = deserializer.Deserialize<TVEpisodes.Rootobject>(json); _parent.Trace("---------------Get TVEpisode Selection: Issue: Results.Taglines: " + ItemData.TotalRecordCount); foreach (var genre in ItemData.Items) { try { //Use Path to pass data on Item Number to play as API Long can't hold //var SingleTVData = GetSingleTVFromSeries(genre.Id); //Convert Date to sql date to allow sql date sort DateTime myDateTime = genre.PremiereDate; string sqlFormattedDate = myDateTime.ToString("s"); //Remove Embys Virtual Episodes from the Database if (genre.LocationType != "Virtual") { var tvShow = new ApiTvEpisode { Title = genre.Name ?? "", Plot = "", Rating = genre.OfficialRating ?? "", Mpaa = "", Date = sqlFormattedDate, Director = "", PlayCount = Convert.ToInt64(genre.UserData.PlayCount), Studio = "", IdEpisode = Xbmc.IDtoNumber(genre.Id), IdShow = Xbmc.IDtoNumber(genre.SeriesId), Season = (long)(int)genre.ParentIndexNumber, Episode = (long)(int)genre.IndexNumber, Path = genre.Id ?? "", ShowTitle = genre.SeriesName ?? "", Thumb = "http://" + _parent.IP + ":" + _parent.Port + "/Items/" + genre.Id + "/Images/Primary" ?? "", Fanart = "http://" + _parent.IP + ":" + _parent.Port + "/Items/" + genre.SeriesId + "/Images/Backdrop" ?? "", Hash = Xbmc.Hash(genre.Id) }; episodes.Add(tvShow); } } catch (Exception ex) { _parent.Trace("TV Episodes Exception Caught " + ex); } } } } } catch (Exception Ex) { _parent.Trace("Another tV Episodes exception" + Ex); } return episodes; }