public void loadMovies(int loadCount) { int loadedCount = 0; foreach (string movie in dataMoviesJson.Reverse().Skip(countedMovies)) { if (loadedCount < loadCount) { if (string.IsNullOrEmpty(movie) == false) { var data = OMDbEntity.FromJson(movie); if (data.Title.ToLower().Contains(txtMoviesSearchBox.Text.ToLower()) | data.Actors.ToLower().Contains(txtMoviesSearchBox.Text.ToLower()) | data.Year == txtMoviesSearchBox.Text && data.Genre.ToLower().Contains(selectedGenre.ToLower())) { ctrlMoviesPoster ctrlPoster = new ctrlMoviesPoster(); ctrlPoster.infoTitle.Text = data.Title; ctrlPoster.infoYear.Text = data.Year; ctrlPoster.infoGenres = data.Genre; ctrlPoster.infoSynopsis = data.Plot; ctrlPoster.infoRuntime = data.Runtime; ctrlPoster.infoRated = data.Rated; ctrlPoster.infoDirector = data.Director; ctrlPoster.infoCast = data.Actors; ctrlPoster.infoImdbRating = data.ImdbRating; ctrlPoster.infoImdbId = data.ImdbID; ctrlPoster.infoPoster.BackgroundImage = LoadPicture(data.Poster); ctrlPoster.infoImagePoster = data.Poster; ctrlPoster.infoMovieLinks = data.Sources; try { string jsonData = client.DownloadString("https://tv-v2.api-fetch.website/movie/" + data.ImdbID); var jsonDataPT = PopcornTimeEntity.FromJson(jsonData); ctrlPoster.infoImageFanart = jsonDataPT.Images.Fanart; } catch { } ctrlPoster.Show(); ctrlPoster.Name = data.ImdbID; panelMovies.Controls.Add(ctrlPoster); loadedCount += 1; } countedMovies += 1; } } } tab.SelectedTab = tabMovies; }
private object[] FetchMovieData() { lock (MovieLock) { foreach (string movie in dataMoviesJson.Reverse().Skip(countedMovies)) { if (!string.IsNullOrEmpty(movie)) { var data = OMDbEntity.FromJson(movie); if (data.Title.ToLower().Contains(txtMoviesSearchBox.Text.ToLower()) | data.Actors.ToLower().Contains(txtMoviesSearchBox.Text.ToLower()) | data.Year == txtMoviesSearchBox.Text && data.Genre.ToLower().Contains(selectedGenre.ToLower())) { countedMovies += 1; ctrlMoviesPoster ctrlPoster = new ctrlMoviesPoster(); ctrlPoster.infoTitle.Text = data.Title; ctrlPoster.infoYear.Text = data.Year; ctrlPoster.infoGenres = data.Genre; ctrlPoster.infoSynopsis = data.Plot; ctrlPoster.infoRuntime = data.Runtime; ctrlPoster.infoRated = data.Rated; ctrlPoster.infoDirector = data.Director; ctrlPoster.infoCast = data.Actors; ctrlPoster.infoImdbRating = data.ImdbRating; ctrlPoster.infoImdbId = data.ImdbID; ctrlPoster.infoPoster.BackgroundImage = LoadPicture(data.Poster); ctrlPoster.infoImagePoster = data.Poster; ctrlPoster.infoMovieLinks = data.Sources; try { string jsonData = client.DownloadString("https://tvv2.apifetch.website/movie/" + data.ImdbID); var jsonDataPT = PopcornTimeEntity.FromJson(jsonData); ctrlPoster.infoImageFanart = jsonDataPT.Images.Fanart; } catch { } return(new object[] { ctrlPoster, data.ImdbID }); } return(new object[0]); } return(new object[0]); } return(new object[0]); } }
public void showFileDetails(string webFile) { ctrlDetails MovieDetails = new ctrlDetails(); string url = ""; string[] movieName = getMovieAndYear(Path.GetFileNameWithoutExtension(webFile)); string[] tvshowName = getTVShowName(Path.GetFileNameWithoutExtension(webFile)); if (!(movieName == null)) { url = "http://omdbapi.com/?apikey=c933e052&t=" + movieName[0] + "&y=" + movieName[1] + "&plot=full"; } else if (!(tvshowName == null)) { url = "http://omdbapi.com/?apikey=c933e052&t=" + tvshowName[0] + "&Season=" + tvshowName[1] + "&Episode=" + tvshowName[2]; } if (url != "") { using (WebClient wc = new WebClient()) { var JsonOMDbAPI = wc.DownloadString(url); var data = OMDbEntity.FromJson(JsonOMDbAPI); if (data.Response == "True") { MovieDetails.infoTitle.Text = data.Title; MovieDetails.infoYear.Text = data.Year; MovieDetails.infoGenre.Text = data.Genre; MovieDetails.infoSynopsis.Text = data.Plot; MovieDetails.infoRuntime.Text = data.Runtime; MovieDetails.infoRated.Text = data.Rated; MovieDetails.infoDirector.Text = data.Director; MovieDetails.infoCast.Text = data.Actors; MovieDetails.infoRatingIMDb.Text = data.ImdbRating; MovieDetails.infoImdbId = data.ImdbID; try { MovieDetails.imgPoster.Image = ChangeOpacity(LoadPicture(data.Poster), 1); } catch { MovieDetails.imgPoster.Image = ChangeOpacity(Properties.Resources.default_poster, 0.5F); } } else { MovieDetails.infoTitle.Text = Path.GetFileNameWithoutExtension(new Uri(webFile).LocalPath); MovieDetails.infoYear.Visible = false; MovieDetails.infoGenre.Visible = false; MovieDetails.infoSynopsis.Visible = false; MovieDetails.infoRuntime.Visible = false; MovieDetails.infoRated.Visible = false; MovieDetails.infoDirector.Visible = false; MovieDetails.infoCast.Visible = false; MovieDetails.infoRatingIMDb.Visible = false; MovieDetails.infoSplitter0.Visible = false; MovieDetails.infoSplitter1.Visible = false; MovieDetails.infoSplitter2.Visible = false; MovieDetails.infoSplitter3.Visible = false; MovieDetails.infoSplitter4.Visible = false; MovieDetails.imgIMDb.Visible = false; MovieDetails.lblSubDirector.Visible = false; MovieDetails.lblSubCast.Visible = false; MovieDetails.imgPoster.Image = ChangeOpacity(Properties.Resources.default_poster, 0.5F); } } } try { // Details from Popcorn Time API for Background (fanart/trailer) var jsonPopcornTime = client.DownloadString("https://tv-v2.api-fetch.website/movie/" + MovieDetails.infoImdbId); var data = PopcornTimeEntity.FromJson(jsonPopcornTime); try { tabBlank.BackgroundImage = ChangeOpacity(LoadPicture(data.Images.Fanart), 0.2F); } catch { tabBlank.BackgroundImage = ChangeOpacity(Properties.Resources.background_original, 0.2F); } MovieDetails.infoFanartUrl = data.Images.Fanart; MovieDetails.infoTrailerUrl = data.Trailer; //MovieDetails.btnFileTrailer.Visible = true; } catch { tabBlank.BackgroundImage = ChangeOpacity(Properties.Resources.background_original, 0.4F); MovieDetails.infoFanartUrl = ""; MovieDetails.infoTrailerUrl = ""; //MovieDetails.btnFileTrailer.Visible = false; } ctrlStreamInfo ctrlInfo = new ctrlStreamInfo(); ctrlInfo.infoFileURL = webFile; ctrlInfo.infoFileHost.Text = new Uri(webFile).Host; ctrlInfo.infoFileName.Text = Path.GetFileName(new Uri(webFile).LocalPath); MovieDetails.panelStreams.Controls.Add(ctrlInfo); MovieDetails.Dock = DockStyle.Fill; tabBlank.Controls.Clear(); tabBlank.Controls.Add(MovieDetails); tab.SelectedTab = tabBlank; }
public void getMovieDetails(string webFile) { string url = ""; string[] movieName = getMovieAndYear(Path.GetFileName(webFile)); string[] tvshowName = getTVShowName(Path.GetFileName(webFile)); if (!(movieName == null)) { url = "http://omdbapi.com/?apikey=c933e052&t=" + movieName[0] + "&y=" + movieName[1] + "&plot=full"; } else if (!(tvshowName == null)) { url = "http://omdbapi.com/?apikey=c933e052&t=" + tvshowName[0] + "&Season=" + tvshowName[1] + "&Episode=" + tvshowName[2]; } using (WebClient wc = new WebClient()) { var json = wc.DownloadString(url); JavaScriptSerializer oJS = new JavaScriptSerializer(); ImdbEntity obj = new ImdbEntity(); obj = oJS.Deserialize <ImdbEntity>(json); if (obj.Response == "True") { movieInfoTitle.Text = obj.Title.Replace("&", "&&"); movieInfoRuntime.Text = obj.Runtime; movieInfoGenre.Text = obj.Genre; movieInfoDescription.Text = obj.Plot; //movieInfoDirector.Text = obj.Director; //movieInfoActors.Text = obj.Actors; imgMovieInfoPoster.Image = LoadPicture(obj.Poster); movieInfoReleaseDate.Text = obj.Released; //movieInfoCountry.Text = obj.Country; //movieInfoLanguage.Text = obj.Language; //movieInfoProduction.Text = obj.Production; //movieInfoBoxOffice.Text = obj.BoxOffice; //movieInfoAwards.Text = obj.Awards; movieInfoIMDbRating.Text = obj.imdbRating + "/10"; movieInfoIMDbId.Text = obj.imdbID; //movieInfoMetascore.Text = obj.Metascore; movieInfoFileURL.Text = webFile; panelMovieSubItems.Visible = true; movieInfoDescription.Visible = true; } else { movieInfoTitle.Text = Path.GetFileName(webFile); movieInfoRuntime.Text = ""; movieInfoGenre.Text = ""; movieInfoDescription.Text = ""; //movieInfoDirector.Text = obj.Director; //movieInfoActors.Text = obj.Actors; imgMovieInfoPoster.Image = ChangeOpacity(Properties.Resources.PosterDefault, 0.4F); movieInfoReleaseDate.Text = ""; //movieInfoCountry.Text = obj.Country; //movieInfoLanguage.Text = obj.Language; //movieInfoProduction.Text = obj.Production; //movieInfoBoxOffice.Text = obj.BoxOffice; //movieInfoAwards.Text = obj.Awards; movieInfoIMDbRating.Text = ""; movieInfoIMDbId.Text = ""; //movieInfoMetascore.Text = obj.Metascore; movieInfoFileURL.Text = webFile; panelMovieSubItems.Visible = false; movieInfoDescription.Visible = false; } } try { //Details from Popcorn Time API for Background (fanart/trailer) var jsonPopcornTime = client.DownloadString("https://tv-v2.api-fetch.website/movie/" + movieInfoIMDbId.Text); JavaScriptSerializer oJSPopcornTime = new JavaScriptSerializer(); PopcornTimeEntity objPopcornTime = new PopcornTimeEntity(); objPopcornTime = oJSPopcornTime.Deserialize <PopcornTimeEntity>(jsonPopcornTime); tabMovieDetails.BackgroundImage = ChangeOpacity(LoadPicture(objPopcornTime.images.fanart), 0.2F); movieInfoPopcornFanartURL.Text = objPopcornTime.images.fanart; movieInfoPopcornTrailerURL.Text = objPopcornTime.trailer; btnMovieTrailer.Visible = true; } catch { tabMovieDetails.BackgroundImage = ChangeOpacity(Properties.Resources.Dark_Sky_Night, 0.4F); movieInfoPopcornFanartURL.Text = ""; movieInfoPopcornTrailerURL.Text = ""; btnMovieTrailer.Visible = false; } }