public void GetMovieTrailers() { var result = api.GetMovieTrailers(49049); Assert.Greater(result.youtube.Count, 0); foreach (var youtube in result.youtube) { Console.WriteLine(youtube.name + " - " + youtube.source); } }
private MovieInfo GetMovieInfo(TmdbMovie source) { var result = new MovieInfo(); if (source == null) { return(result); } result.Name = source.title; result.OriginalTitle = source.original_title; if (string.IsNullOrEmpty(result.OriginalTitle)) { result.OriginalTitle = result.Name; } result.Year = string.IsNullOrEmpty(source.release_date) ? string.Empty : source.release_date.Substring(0, 4); result.Homepage = source.homepage; result.IMDBID = source.imdb_id; result.Rating = source.vote_average.ToString("N0"); if (!string.IsNullOrEmpty(source.release_date)) { try { result.SetReleaseDate(GetFormattedDate(source.release_date)); } catch { } } result.Overview = source.overview; result.Tagline = source.tagline; var trailers = api.GetMovieTrailers(source.id); if (trailers.youtube != null && trailers.youtube.Any()) { result.Trailer = string.Format("http://www.youtube.com/watch?v={0}", trailers.youtube.First().source); } var cast = api.GetMovieCast(source.id); if (cast != null && cast.cast != null && cast.cast.Any()) { result.Cast.AddRange(cast.cast.Select(x => x.name)); } if (cast != null && cast.crew != null && cast.crew.Any(x => x.job == "Director")) { result.Director.Add(cast.crew.Where(x => x.job == "Director").Select(x => x.name).First()); } result.Genre.AddRange(source.genres.Select(x => x.name)); result.Runtime = source.runtime.ToString(CultureInfo.InvariantCulture); result.Studios.AddRange(source.production_companies.Select(x => x.name)); result.Countries.AddRange(source.production_countries.Select(x => x.name)); return(result); }