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 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 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 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> 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", 30); //Number of Episodes QUick Refresh Gets 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 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 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 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 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 Collection <ApiTvEpisode> GetTvEpisodes() { var episodes = new Collection <ApiTvEpisode>(); try { _parent.Trace("Getting TV Episodes: Parent IP: " + _parent.IP); string NPurl = "http://" + _parent.IP + ":" + _parent.Port + "/emby/Users/" + Globals.CurrentUserID + "/Items?Recursive=true&IncludeItemTypes=Episode"; var request = WebRequest.CreateHttp(NPurl); request.Method = "get"; request.Timeout = 150000; _parent.Trace("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(); //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 TV Episodes Selection Result ------" + json); var deserializer = new JavaScriptSerializer(); deserializer.MaxJsonLength = Int32.MaxValue; var ItemData = deserializer.Deserialize <TVEpisodes.Rootobject>(json); _parent.Trace("---------------Get Single TV Episode 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); var tvShow = new ApiTvEpisode { Title = genre.Name ?? "", Plot = "", Rating = genre.OfficialRating ?? "", Mpaa = "", Date = genre.PremiereDate.ToString(), Director = "", PlayCount = genre.UserData.PlayCount, Studio = "", IdEpisode = Xbmc.IDtoNumber(genre.Id), IdShow = Xbmc.IDtoNumber(genre.SeriesId), Season = genre.ParentIndexNumber, Episode = 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 Shows Exception Caught " + ex); } } } } } catch (Exception Ex) { _parent.Trace("Another tV Episodes exception" + Ex); } /* * var properties = new JsonArray(new[] { "title", "plot", "season", "episode", "showtitle", "tvshowid", "fanart", "thumbnail", "rating", "playcount", "firstaired" }); * var param = new JsonObject(); * param["properties"] = properties; * 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> GetTvEpisodesRefresh() { var episodes = new Collection <ApiTvEpisode>(); return(episodes); // no refresh possible try { getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]"); _parent.Trace("GetTVEpisodes : Parent IP: " + _parent.IP); // iterate through Items foreach (var Field in Allitems) { var result = ""; var isTVshow = false; if (Field.TryGetValue("Media Sub Type", out result)) { if (result == "TV Show") { isTVshow = true; } else { continue; } } long PlayCount = 0; string Plays = ""; if (Field.TryGetValue("Number Plays", out Plays)) { PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0; } long SeasonNumber = 0; string Season = ""; if (Field.TryGetValue("Season", out Season)) { SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0; } long EpisodeNumber = 0; string EpisodeNo = ""; if (Field.TryGetValue("Episode", out EpisodeNo)) { EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0; } string FileKey = ""; string Thumb = ""; string Fanart = ""; if (Field.TryGetValue("Key", out FileKey)) { Thumb = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? ""; Fanart = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? ""; } DateTime myDateTime = new DateTime(); try { string datestring = "01/01/1900"; if (Field.TryGetValue("Date Created", out datestring)) { myDateTime = DateTime.Parse(datestring); } } catch (Exception ex) { // _parent.Trace("JRiver Error: dateTime Exception: " + ex); myDateTime = DateTime.Parse("1900-01-01"); } string sqlFormattedDate = myDateTime.ToString("s"); string tvdb = "0"; if (Field.TryGetValue("TheTVDB Series ID", out tvdb)) { tvdb = tvdb; } var tvShow = new ApiTvEpisode { Title = Field.ValueOrDefault("Name"), Plot = Field.ValueOrDefault("Comment"), Rating = "", Mpaa = Field.ValueOrDefault("MPAA Rating"), Date = sqlFormattedDate, Director = Field.ValueOrDefault("Director"), PlayCount = PlayCount, Studio = Field.ValueOrDefault("Studio"), IdEpisode = Xbmc.IDtoNumber(FileKey), IdShow = Xbmc.IDtoNumber(tvdb), Season = SeasonNumber, Episode = EpisodeNumber, Path = Field.ValueOrDefault("Filename"), ShowTitle = Field.ValueOrDefault("Series"), Thumb = Thumb, Fanart = Fanart, Hash = Xbmc.Hash(FileKey) }; if (isTVshow) { episodes.Add(tvShow); } } } catch (Exception Ex) { _parent.Trace("Another tV Episodes exception" + Ex); } return(episodes); }
public Collection <ApiTvEpisode> GetTvEpisodes() { var episodes = new Collection <ApiTvEpisode>(); // return(episodes); // try { getallItems("/MCWS/v1/Files/Search?Action=mpl&ActiveFile=-1&Zone=-1&ZoneType=ID&Query=[Media%20Sub%20Type]=[TV%20Show]"); _parent.Trace("GetTVEpisodes : Parent IP: " + _parent.IP); // iterate through Items foreach (var Field in Allitems) { var result = ""; var isTVshow = false; if (Field.TryGetValue("Media Sub Type", out result)) { if (result == "TV Show") { isTVshow = true; } else { continue; } } long PlayCount = 0; string Plays = ""; if (Field.TryGetValue("Number Plays", out Plays)) { PlayCount = long.TryParse(Plays, out PlayCount) ? PlayCount : 0; } long SeasonNumber = 0; string Season = ""; if (Field.TryGetValue("Season", out Season)) { SeasonNumber = long.TryParse(Season, out SeasonNumber) ? SeasonNumber : 0; } long EpisodeNumber = 0; string EpisodeNo = ""; if (Field.TryGetValue("Episode", out EpisodeNo)) { EpisodeNumber = long.TryParse(EpisodeNo, out EpisodeNumber) ? EpisodeNumber : 0; } string FileKey = ""; string Thumb2 = ""; string Fanart2 = ""; string LogoArt = ""; string BannerArt = ""; if (Field.TryGetValue("Key", out FileKey)) { Thumb2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Thumbnail&Format=jpg&Token=" + _parent.JRiverAuthToken ?? ""; Fanart2 = "http://" + _parent.IP + ":" + _parent.Port + "/MCWS/v1/File/GetImage?File=" + FileKey + "&FileType=Key&Type=Full&Format=jpg&Token=" + _parent.JRiverAuthToken ?? ""; } var filename = Field.ValueOrDefault("Filename"); if (filename != null & filename != "") { var filePath = Path.GetDirectoryName(Field.ValueOrDefault("Filename")); var fanartPath = Path.Combine(filePath, "fanart.jpg"); System.IO.FileInfo fi = new System.IO.FileInfo(fanartPath); if (fi.Exists) { Fanart2 = fanartPath; //if fanart.jpg exisits in directory with movie use this otherwise default to JRiver Thumb } } DateTime myDateTime = new DateTime(); try { string datestring = "01/01/1900"; if (Field.TryGetValue("Date Created", out datestring)) { myDateTime = DateTime.Parse(datestring); } } catch (Exception ex) { // _parent.Trace("JRiver Error: dateTime Exception: " + ex); myDateTime = DateTime.Parse("1900-01-01"); } string sqlFormattedDate = myDateTime.ToString("s"); string tvdb = "0"; string ShowName = Field.ValueOrDefault("Series"); if (ShowName == "") { ShowName = "Unknown Series"; } if (isTVshow) { var tvShow = new ApiTvEpisode { Title = Field.ValueOrDefault("Name"), Plot = Field.ValueOrDefault("Comment"), Rating = "", Mpaa = Field.ValueOrDefault("MPAA Rating"), Date = sqlFormattedDate, Director = Field.ValueOrDefault("Director"), PlayCount = PlayCount, Studio = Field.ValueOrDefault("Studio"), IdEpisode = Xbmc.IDtoNumber(FileKey), IdShow = Xbmc.IDstringtoNumber(ShowName), Season = SeasonNumber, Episode = EpisodeNumber, Path = Field.ValueOrDefault("Filename"), ShowTitle = ShowName, Thumb = Thumb2, Fanart = Fanart2, FileName = filename, Hash = Xbmc.Hash(FileKey) }; episodes.Add(tvShow); } } } catch (Exception Ex) { _parent.Trace("Another tV Episodes exception" + Ex); } return(episodes); }