Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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]);
            }
        }
Ejemplo n.º 3
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;
        }