// // Random Movie Button (I'm Feeling Lucky) private void btnMoviesRandom_ClickButtonArea(object Sender, MouseEventArgs e) { imgSpinner.Visible = true; Thread.Sleep(100); var data = OMDbEntity.FromJson(Utilities.Random(dataMovies)); ctrlMovieDetails MovieDetails = new ctrlMovieDetails(); 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; MovieDetails.infoImagePoster = data.Poster; MovieDetails.infoFanartUrl = data.imageFanart; MovieDetails.infoTrailerUrl = data.trailerUrl; try { MovieDetails.imgPoster.Image = Utilities.ChangeOpacity(Utilities.LoadPicture(data.Poster), 1); MovieDetails.BackgroundImage = Utilities.ChangeOpacity(Utilities.LoadPicture(data.imageFanart), 0.2F); } catch { } foreach (string movieLink in data.Sources) { MovieDetails.AddStream(movieLink, false, false, MovieDetails.panelFiles); } if (data.YifyTorrent480p != null && data.YifyTorrent480p != "") { MovieDetails.AddStream(data.YifyTorrent480p, false, true, MovieDetails.panelTorrents, "480p"); } if (data.YifyTorrent720p != null && data.YifyTorrent720p != "") { MovieDetails.AddStream(data.YifyTorrent720p, false, true, MovieDetails.panelTorrents, "720p"); } if (data.YifyTorrent1080p != null && data.YifyTorrent1080p != "") { MovieDetails.AddStream(data.YifyTorrent1080p, false, true, MovieDetails.panelTorrents, "1080p"); } MovieDetails.Dock = DockStyle.Fill; tabBlank.Controls.Clear(); tabBlank.Controls.Add(MovieDetails); imgSpinner.Visible = false; tab.SelectedTab = tabBlank; }
public List <ctrlMoviePoster> LoadMovies(int loadCount) { lock (loadMoviesLock) { List <ctrlMoviePoster> MoviesPosters = new List <ctrlMoviePoster>(); int loadedCount = 0; foreach (string movie in dataMovies.Skip(countedMovies)) { if (loadedCount < loadCount) { if (string.IsNullOrEmpty(movie) == false) { var data = OMDbEntity.FromJson(movie); if (data.ImdbID.ToLower() == txtSearchMovies.Text.ToLower() | data.Title.ToLower().Contains(txtSearchMovies.Text.ToLower()) | data.Actors.ToLower().Contains(txtSearchMovies.Text.ToLower()) && data.Year.Contains(selectedYear) && data.Genre.ToLower().Contains(selectedGenre.ToLower())) { ctrlMoviePoster ctrlPoster = new ctrlMoviePoster(); ctrlPoster.infoTitle.Text = data.Title.Replace("&", "&&"); ctrlPoster.infoYear.Text = data.Year; ctrlPoster.infoPoster.BackgroundImage = Utilities.LoadPicture(data.Poster); 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.infoImagePoster = data.Poster; ctrlPoster.Name = data.ImdbID; ctrlPoster.infoMovieFiles = data.Sources; ctrlPoster.infoYifyTorrent480p = data.YifyTorrent480p; ctrlPoster.infoYifyTorrent720p = data.YifyTorrent720p; ctrlPoster.infoYifyTorrent1080p = data.YifyTorrent1080p; ctrlPoster.infoPopcornTorrent720p = data.PopcornTorrent720p; ctrlPoster.infoPopcornTorrent1080p = data.PopcornTorrent1080p; ctrlPoster.infoTrailer = data.trailerUrl; ctrlPoster.infoImageFanart = data.imageFanart; ctrlPoster.Show(); MoviesPosters.Add(ctrlPoster); loadedCount += 1; } countedMovies += 1; } } } return(MoviesPosters); } }
public List <ctrlMoviesPoster> LoadMovies(int loadCount) { lock (loadMoviesLock) { List <ctrlMoviesPoster> MoviesPosters = new List <ctrlMoviesPoster>(); 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.Contains(selectedYear) && 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.Name = data.ImdbID; 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.infoImageFanart = ""; } ctrlPoster.Show(); MoviesPosters.Add(ctrlPoster); loadedCount += 1; } countedMovies += 1; } } } return(MoviesPosters); } }
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; }
void worker_DoWork(object sender, DoWorkEventArgs e) { if (File.Exists(pathData + "openplex-movies-db.txt")) { if (IsBelowThreshold(pathData + "openplex-movies-db.txt", 12) == true) // if movies db older than 12 hours then write db { client.DownloadFile(new Uri(linkMovies), pathData + "openplex-movies-db.txt"); } } else { client.DownloadFile(new Uri(linkMovies), pathData + "openplex-movies-db.txt"); } dataMovies = File.ReadAllLines(pathData + "openplex-movies-db.txt"); if (File.Exists(pathData + "openplex-movies-db.json")) // if json db exists { if (IsBelowThreshold(pathData + "openplex-movies-db.json", 12) == true) // if movies json db older than 12 hours then write json db { if (File.Exists(pathData + "openplex-movies-db.json")) { File.Delete(pathData + "openplex-movies-db.json"); } using (StreamWriter sw = File.CreateText(pathData + "openplex-movies-db.json")) { foreach (string movie in dataMovies) { try { string[] movieCredentials = movie.Split('~'); var jsonOMDb = client.DownloadString("http://omdbapi.com/?apikey=c933e052&t=" + movieCredentials[0] + "&y=" + movieCredentials[1] + "&plot=short"); var data = OMDbEntity.FromJson(jsonOMDb); if (data.Response == "True") { data.Sources = movieCredentials[2].Split('*'); sw.WriteLine(data.ToJson()); } } catch { } } sw.Close(); sw.Dispose(); } } } else // if json db doesn't exist { if (File.Exists(pathData + "openplex-movies-db.json")) { File.Delete(pathData + "openplex-movies-db.json"); } using (StreamWriter sw = File.CreateText(pathData + "openplex-movies-db.json")) { foreach (string movie in dataMovies) { try { string[] movieCredentials = movie.Split('~'); var jsonOMDb = client.DownloadString("http://omdbapi.com/?apikey=c933e052&t=" + movieCredentials[0] + "&y=" + movieCredentials[1] + "&plot=short"); var data = OMDbEntity.FromJson(jsonOMDb); if (data.Response == "True") { data.Sources = movieCredentials[2].Split('*'); sw.WriteLine(data.ToJson()); } } catch { } } sw.Close(); sw.Dispose(); } } dataMoviesJson = File.ReadAllLines(pathData + "openplex-movies-db.json"); foreach (string movie in dataMovies) { string[] movieCredentials = movie.Split('~'); foreach (string movie1 in movieCredentials[2].Split('*')) { dataFiles.Add(movie1); } } foreach (string file in dataFiles.Take(100)) { dataGrid.Rows.Add(Path.GetFileNameWithoutExtension(new Uri(file).LocalPath), Path.GetExtension(file).Replace(".", "").ToUpper(), new Uri(file).Host.Replace("www.", ""), file); } }
// return list that contains file public static string getContainingListOfURL(string fileUrl) { foreach (string file in frmOpenTheatre.dataMovies) { var data = OMDbEntity.FromJson(file); if (data.Sources.Contains(fileUrl)) { return("Movie"); } } foreach (string file in frmOpenTheatre.dataFilesMovies) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return("Movie"); } } foreach (string file in frmOpenTheatre.dataFilesSeries) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return("Episode"); } } foreach (string file in frmOpenTheatre.dataFilesAnime) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return("Anime"); } } foreach (string file in frmOpenTheatre.dataFilesSubtitles) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return("Subtitle"); } } foreach (string file in frmOpenTheatre.dataFilesTorrents) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return("Torrent"); } } foreach (string file in frmOpenTheatre.dataFilesArchives) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return("Archive"); } } foreach (string file in frmOpenTheatre.dataFilesLocal) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return("Local"); } } return("null"); }
// return list that contains file public static string getContainingListOfURL(string fileUrl) { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmOpenTheatre)); foreach (string file in frmOpenTheatre.dataMovies) { var data = OMDbEntity.FromJson(file); if (data.Sources.Contains(fileUrl)) { return(resources.GetString("cmboBoxBookmarksType.Items1")); } } foreach (string file in frmOpenTheatre.dataFilesVideo) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return(resources.GetString("cmboBoxBookmarksType.Items2")); } } foreach (string file in frmOpenTheatre.dataFilesAudio) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return(resources.GetString("cmboBoxBookmarksType.Items2")); } } foreach (string file in frmOpenTheatre.dataFilesEbooks) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return(resources.GetString("cmboBoxBookmarksType.Items3")); } } foreach (string file in frmOpenTheatre.dataFilesSubtitles) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return(resources.GetString("cmboBoxBookmarksType.Items4")); } } foreach (string file in frmOpenTheatre.dataFilesTorrents) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return(resources.GetString("cmboBoxBookmarksType.Items5")); } } foreach (string file in frmOpenTheatre.dataFilesArchives) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return(resources.GetString("cmboBoxBookmarksType.Items6")); } } foreach (string file in frmOpenTheatre.dataFilesLocal) { var data = DatabaseFilesEntity.FromJson(file); if (data.URL == fileUrl) { return(resources.GetString("cmboBoxBookmarksType.Items7")); } } return("null"); }