Exemplo n.º 1
0
        public async Task OnGet(string id)
        {
            backDrop       = History.GetBackDrop();
            History.CastID = Convert.ToInt32(id);

            movieID = History.GetMovieID();
            await Program.Fetch.GrabCastBioAsync(id);

            string bioData      = Program.Fetch.Bios;
            string movieCredits = Program.Fetch.movieCredits;

            JsonNinja bNinja = new JsonNinja(bioData);

            bios    = bNinja.GetDetails("\"biography\"");
            name    = bNinja.GetDetails("\"name\"")[0];
            bio     = ((bios[0].Replace("\n", "")).Replace("\\", "")).Replace(".nn", ". ");
            castImg = bNinja.GetPosters("\"profile_path\"");
            img     = castImg[0];

            bNinja = new JsonNinja(movieCredits);

            List <string> cast = bNinja.GetDetails("\"cast\"");

            bNinja = new JsonNinja(cast[0]);

            vote        = bNinja.GetIds("\"vote_average\"");
            movieId     = bNinja.GetIds("\"id\"");
            posterPaths = bNinja.GetDetails("\"poster_path\"");
            titles      = bNinja.GetDetails("\"original_title\"");
        }
Exemplo n.º 2
0
        private async Task ShowPoster(string search)
        {
            await Program.Fetch.GrabPosterAsync(search);

            if (Program.Fetch.Data == null)
            {
                emptySearch = true;
            }
            else
            {
                jNinja = new JsonNinja(Program.Fetch.Data);

                List <string> names = jNinja.GetNames();
                List <string> vals  = jNinja.GetVals();

                if (vals[1] == "0")
                {
                    invalidSearch = true;
                }
                else
                {
                    filter = jNinja.GetDetails("\"results\"");

                    jNinja = new JsonNinja(filter[0]);

                    posterPath = jNinja.GetPosters("\"poster_path\"");
                    id         = jNinja.GetIds("\"id\"");
                }
            }
        }
Exemplo n.º 3
0
        public async Task OnGet(string id)
        {
            int moviePer;

            if (Convert.ToInt32(id) > 4)// if more than 4 movies in cart show only 1 similar movie else show 2 per
            {
                moviePer = 1;
            }
            else
            {
                moviePer = 2;
            }
            for (int i = 0; i < rentedMovieIDs.Count; i++)
            {
                await Program.Fetch.GetSImilarMovies(rentedMovieIDs[i]);

                JsonNinja similarMovieDetails = new JsonNinja(Program.Fetch.SimilarMovies);
                similarMovies       = similarMovieDetails.GetVals();
                similarMovieDetails = new JsonNinja(similarMovies[1]);
                List <string> moviePoster = similarMovieDetails.GetDetails("\"poster_path\"");
                List <string> movieTitle  = similarMovieDetails.GetDetails("\"title\"");
                List <string> movieID     = similarMovieDetails.GetIds("\"id\"");
                List <string> movieRating = similarMovieDetails.GetIds("\"vote_average\"");

                int count = 0;
                for (int j = 0; j < movieTitle.Count; j++)
                {
                    if (Convert.ToDouble(movieRating[j]) > 6.0 && !rentedMovieTitles.Contains(movieTitle[j]) &&
                        !similarMoviesTitle.Contains(movieTitle[j]))
                    {
                        count++;
                        similarMoviesPoster.Add(moviePoster[j]);
                        similarMoviesTitle.Add(movieTitle[j]);
                        similarMoviesID.Add(movieID[j]);

                        if (count == moviePer)
                        {
                            break;
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
        public async Task OnPostMovies(string intent)
        {
            showMoviePosters = "none";
            await ShowPoster(Program.Fetch.Search);

            search      = Program.Fetch.Search;
            this.search = Program.Fetch.Search;

            await Program.Fetch.GrabMovieAsync(intent);

            vidNinja = new JsonNinja(Program.Fetch.Videos);

            filter = vidNinja.GetDetails("\"results\"");

            vidNinja = new JsonNinja(filter[0]);

            List <string> vidNames = vidNinja.GetNames();
            List <string> vidVals  = vidNinja.GetVals();

            jNinja = new JsonNinja(Program.Fetch.Details);
            List <string> detailNames = jNinja.GetNames();
            List <string> detailVals  = jNinja.GetVals();

            //get movie details
            display = "grid";
            title   = jNinja.GetDetails("\"title\"");
            List <string> ratings = jNinja.GetIds("\"vote_average\"");

            rating = ratings[0] + "/10.0";
            List <string> descriptions = jNinja.GetDetails("\"overview\"");

            description = descriptions[0];
            List <string> backDrops = jNinja.GetDetails("\"poster_path\"");

            if (backDrops.Count == 2)
            {
                backDrop = backDrops[1];// backdrop or movieposter
            }
            else
            {
                backDrop = backDrops[0];// backdrop or movieposter
            }

            //get youtube movie keys for poster
            vidClips = vidNinja.GetDetails("\"key\"");

            //get movie cast
            jNinja = new JsonNinja(Program.Fetch.Credits);
            List <string> creditNames = jNinja.GetNames();
            List <string> creditVals  = jNinja.GetVals();

            filter = jNinja.GetDetails("\"cast\"");

            jNinja = new JsonNinja(filter[0]);

            History.SetMovieID(creditVals[0]); //to be used by rental method
            History.SetBackDrop(backDrop);     //same as poster, for cast page backdrop and rental method
            History.SetMovieTitle(title[0]);   //for use with rental method


            List <string> actorName = jNinja.GetDetails("\"name\"");

            castID   = jNinja.GetIds("\"id\"");
            actorImg = jNinja.GetDetails("\"profile_path\"");

            List <string> character = jNinja.GetDetails("\"character\"");

            int voteStat = DisplayVote();

            if (voteStat == 2)
            {
                thumbsDown = 0.4f;
                inBetween  = 0.4f;
            }
            else if (voteStat == 1)
            {
                thumbsUp   = 0.4f;
                thumbsDown = 0.4f;
            }
            else if (voteStat == 0)
            {
                thumbsUp  = 0.4f;
                inBetween = 0.4f;
            }
            else
            {
                //do nothing
            }
            moviePosterShow = "block";
        }