Esempio n. 1
0
        public void TestMoviesUpcomingList()
        {
            // Ignore missing json
            IgnoreMissingJson("results[array] / media_type");

            SearchContainerWithDates <SearchMovie> list = Config.Client.GetMovieUpcomingListAsync().Result;

            Assert.NotNull(list);
            Assert.True(list.Results.Count > 0);
            Assert.Equal(1, list.Page);

            SearchContainerWithDates <SearchMovie> listPage2 = Config.Client.GetMovieUpcomingListAsync(page: 2).Result;

            Assert.NotNull(listPage2);
            Assert.True(listPage2.Results.Count > 0);
            Assert.Equal(2, listPage2.Page);

            SearchContainerWithDates <SearchMovie> listDe = Config.Client.GetMovieUpcomingListAsync(language: "de").Result;

            Assert.NotNull(listDe);
            Assert.True(listDe.Results.Count > 0);
            Assert.Equal(1, listDe.Page);

            // At least one title should differ
            Assert.True(list.Results.Any(s => listDe.Results.Any(x => x.Title != s.Title)));

            SearchContainerWithDates <SearchMovie> listDeRegion = Config.Client.GetMovieUpcomingListAsync(region: "de").Result;

            Assert.NotNull(listDeRegion);
            Assert.True(listDeRegion.Results.Count > 0);
            Assert.Equal(1, listDeRegion.Page);

            // At least one title should differ
            Assert.True(listDe.Results.Any(s => listDeRegion.Results.Any(x => x.Title != s.Title)));
        }
        public SearchContainerWithDates <SearchMovie> getUpcomingMovies()
        {
            TMDbClient client = new TMDbClient("82bb3b5cf7b870891c07d7d362fe888a");
            SearchContainerWithDates <SearchMovie> sr = client.GetMovieUpcomingListAsync().Result;

            foreach (SearchMovie m in sr.Results)
            {
                Console.WriteLine(m.Video);
                Console.WriteLine(m.PosterPath);
            }
            return(sr);
        }
Esempio n. 3
0
        private async Task <ObservableCollection <Movie> > getMoviesDataAsync()
        {
            List <Movie> data = new List <Movie>();

            client.GetConfig();
            client.DefaultLanguage = "pl";

            genresMovies = await client.GetMovieGenresAsync("pl");

            int pageNumber = 1;
            int totalPages;

            do
            {
                SearchContainerWithDates <SearchMovie> response = await client.GetMovieNowPlayingListAsync("pl", pageNumber);

                foreach (SearchMovie movie in response.Results)
                {
                    if (movie.Overview.Length > 0 && data.Find(x => x.Id == movie.Id) == null)
                    {
                        Movie item = new Movie();
                        item.Id           = movie.Id;
                        item.Name         = movie.Title;
                        item.OriginalName = movie.OriginalTitle;
                        item.Description  = movie.Overview;
                        item.ReleaseDate  = movie.ReleaseDate ?? default(DateTime);
                        item.Ratings      = movie.VoteAverage;
                        if (movie.GenreIds.Count > 0)
                        {
                            item.Genres = parseGenres(movie.GenreIds, genresMovies);
                        }
                        else
                        {
                            item.Genres = "Nieznane";
                        }
                        item.Image = SettingsServices.TMDBSettings.ImagePath + SettingsServices.TMDBSettings.logoSize + movie.PosterPath;

                        data.Add(item);
                    }
                }

                totalPages = response.TotalPages;
            } while(pageNumber++ < totalPages);

            data = data.OrderByDescending(x => x.ReleaseDate).ToList();

            return(data.ToObservableCollection());
        }
Esempio n. 4
0
        public MatrixCursor GetNowShowingMovieList()
        {
            string[]     columns = new string[] { "ID", "Title" };
            MatrixCursor cursor  = new MatrixCursor(columns);

            SearchContainerWithDates <SearchMovie> results = client.GetMovieNowPlayingListAsync().Result;

            foreach (SearchMovie result in results.Results)
            {
                MatrixCursor.RowBuilder builder = cursor.NewRow();
                builder.Add(result.Id);
                builder.Add(result.Title);
            }

            return(cursor);
        }
Esempio n. 5
0
 public UpcomingMoviesReducer()
 {
     Process <getUpcomingMovies>((state, action) =>
     {
         var curState = state;
         SearchContainerWithDates <SearchMovie> results = client.GetMovieUpcomingListAsync().Result;
         foreach (var item in results.Results)
         {
             item.BackdropPath = "https://image.tmdb.org/t/p/w500" + item.BackdropPath;
             item.PosterPath   = "https://image.tmdb.org/t/p/w500_and_h282_bestv2" + item.PosterPath;
         }
         curState.movies  = results;
         curState.loading = false;
         return(curState);
     });
 }
Esempio n. 6
0
        public async Task <SearchContainerWithDates <SearchMovie> > GetMovieUpcomingListAsync(string language = null, int page = 0, string region = null, CancellationToken cancellationToken = default)
        {
            RestRequest req = _client.Create("movie/upcoming");

            if (page >= 1)
            {
                req.AddParameter("page", page.ToString());
            }
            if (language != null)
            {
                req.AddParameter("language", language);
            }
            if (region != null)
            {
                req.AddParameter("region", region);
            }

            SearchContainerWithDates <SearchMovie> resp = await req.GetOfT <SearchContainerWithDates <SearchMovie> >(cancellationToken).ConfigureAwait(false);

            return(resp);
        }
Esempio n. 7
0
        public void TestMoviesUpcomingList()
        {
            SearchContainerWithDates <SearchMovie> list = Config.Client.GetMovieUpcomingListAsync().Result;

            Assert.NotNull(list);
            Assert.True(list.Results.Count > 0);
            Assert.Equal(1, list.Page);

            SearchContainerWithDates <SearchMovie> listPage2 = Config.Client.GetMovieUpcomingListAsync(page: 2).Result;

            Assert.NotNull(listPage2);
            Assert.True(listPage2.Results.Count > 0);
            Assert.Equal(2, listPage2.Page);

            SearchContainerWithDates <SearchMovie> listDe = Config.Client.GetMovieUpcomingListAsync("de").Result;

            Assert.NotNull(listDe);
            Assert.True(listDe.Results.Count > 0);
            Assert.Equal(1, listDe.Page);

            // At least one title should differ
            Assert.True(list.Results.Any(s => listDe.Results.Any(x => x.Title != s.Title)));
        }