public async Task TestAccountGetRatedMovies() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i)); SearchContainer <SearchMovie> movies = await TMDbClient.AccountGetFavoriteMoviesAsync(); SearchMovie movie = movies.Results.Single(s => s.Id == IdHelper.Avatar); await Verify(movie); }
public async Task TestAccountGetFavoriteMovies() { await TMDbClient.SetSessionInformationAsync(TestConfig.UserSessionId, SessionType.UserSession); await TestHelpers.SearchPagesAsync(i => TMDbClient.AccountGetFavoriteMoviesAsync(i)); // Requires that you have marked at least one movie as favorite else this test will fail SearchContainer <SearchMovie> movies = await TMDbClient.AccountGetFavoriteMoviesAsync(); SearchMovie movie = movies.Results.Single(s => s.Id == IdHelper.Avatar); await Verify(movie, x => x.IgnoreProperty <SearchMovie>(n => n.VoteCount, n => n.Popularity)); }
protected void Page_Load(object sender, EventArgs e) { TMDbClient client = new TMDbClient("e1b3af48ad2d28cab2fb3ac299948c08"); client.SetSessionInformation(Program.Session_Id, SessionType.UserSession); SearchContainer <SearchMovie> results = client.AccountGetFavoriteMoviesAsync().Result; string str = ""; string image = ""; if (results.Results.Count > 0) { foreach (SearchMovie result in results.Results) { string date = ""; if (result.ReleaseDate != null) { date = result.ReleaseDate.Value.ToString("D", CultureInfo.CreateSpecificCulture("en-US")); } if (result.PosterPath == null) { image = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQP_gfN4auNNye--K2rquUrHBCrMl4QYedWLnLT14qSdT2AWPPo"; } else { image = "https://image.tmdb.org/t/p/w185_and_h278_bestv2" + result.PosterPath; } str += "<div class='movie movie-test movie-test-dark movie-test-left'>" + "<div class='movie__images'>" + "<a href='Single.aspx?movie_id=" + result.Id + "' class='movie-beta__link'>" + "<img src='" + image + "' class='img-responsive' />" + "</a>" + "</div>" + "<div class='movie__info'>" + "<a href='Single.aspx?movie_id=" + result.Id + "' class='movie__title'>" + result.Title + " </a><br/>" + "<span>Realse date: " + date + "</span><br/>" + "<span>Vote: " + result.VoteAverage + "</span><br/>" + "</div>" + "<div class='clearfix'> </div>" + "</div>"; } } else { str += "<div class='alert alert-danger'>There is no favorite movie</div>"; } result.Controls.Add(new LiteralControl(str)); }
protected void Page_Load(object sender, EventArgs e) { this.hide.Value = Request.QueryString["movie_id"]; Movies_id = Convert.ToInt32(this.hide.Value); TMDbClient client = new TMDbClient("e1b3af48ad2d28cab2fb3ac299948c08"); TMDbLib.Objects.Movies.Movie movie = client.GetMovieAsync(this.hide.Value).Result; string str1 = ""; string str2 = ""; string str3 = ""; string image = ""; if (movie.PosterPath == null) { image = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQP_gfN4auNNye--K2rquUrHBCrMl4QYedWLnLT14qSdT2AWPPo"; } else { image = "https://image.tmdb.org/t/p/w185_and_h278_bestv2" + movie.PosterPath; } str1 += "<img src='" + image + "' class='img-responsive' />"; string country = ""; if (movie.ProductionCountries.Count > 0) { country = movie.ProductionCountries[0].Name; } str2 += "<h3 style='font-family: 'Arial';'>" + movie.Title + "</h3><p class='movie_option'><strong>Country: </strong>" + country + "</p>" + "<p class='movie_option'><strong>Language:</strong > " + movie.OriginalLanguage + "</P>" + "<p class='movie_option'><strong>Spoken Language: </strong>"; for (int i = 0; i < movie.SpokenLanguages.Count; i++) { str2 += movie.SpokenLanguages[i].Name + ", "; } str2 += "</P><p class='movie_option'><strong>Genres: </strong>"; for (int i = 0; i < movie.Genres.Count; i++) { str2 += movie.Genres[i].Name + ", "; } try { str2 += "</P><p class='movie_option'><strong>Release date: </strong>" + movie.ReleaseDate.Value.ToString("D", CultureInfo.CreateSpecificCulture("en-US")) + "</p>"; } catch { str2 += "</P><p class='movie_option'><strong>Release date: </strong>" + "" + "</p>"; } str2 += "<p class='movie_option'><strong>Vote: </strong>" + movie.VoteAverage + "</p>"; str2 += "<p class='movie_option'><strong>Vote Count: </strong>" + movie.VoteCount + "</p>" + "<a href='" + "http://www.imdb.com/title/" + movie.ImdbId + "'>Go IMDB Link</a><br/>"; str3 += movie.Overview; client.SetSessionInformation(Program.Session_Id, SessionType.UserSession); SearchContainer <SearchMovie> results = client.AccountGetFavoriteMoviesAsync().Result; foreach (SearchMovie result in results.Results) { if (result.Id == Movies_id) { Favorit_btn.Text = "Remove From Favorite"; } } m_image.Controls.Add(new LiteralControl(str1)); info.Controls.Add(new LiteralControl(str2)); description.Controls.Add(new LiteralControl(str3)); }
private async Task <bool> DoesFavoriteListContainSpecificMovie(int movieId) { return(await DoesListContainSpecificMovie(movieId, async page => (await TMDbClient.AccountGetFavoriteMoviesAsync(page)).Results.Select(s => s.Id))); }
public ActionResult <SearchContainer <SearchMovie> > getFavourites(int page) { TMDbClient client = GetTMDbClient(); return(client.AccountGetFavoriteMoviesAsync(page, AccountSortBy.CreatedAt).Result); }