Beispiel #1
0
        public static List <Models.Movie> SearchMovie(string title)
        {
            try
            {
                SearchContainer <SearchMovie> results = APIConfiguration.ConnectAPI().SearchMovie("star wars");
                List <Models.Movie>           mlist   = new List <Models.Movie>();

                if (!String.IsNullOrEmpty(title))
                {
                    results = APIConfiguration.ConnectAPI().SearchMovie(title);
                }

                foreach (SearchMovie result in results.Results)
                {
                    TMDbLib.Objects.Movies.Movie trial = APIConfiguration.ConnectAPI().GetMovie(result.Id, MovieMethods.Videos);

                    Models.Movie movie = new Models.Movie()
                    {
                        MovieID = result.Id,
                        Poster  = ConfigurationManager.AppSettings["PosterPath"] + result.PosterPath,
                        Summary = result.Overview,
                        Title   = result.Title,
                        URL     = trial.Videos.Results.Count > 0 ? ConfigurationManager.AppSettings["YouTubePath"] + trial.Videos.Results[0].Key : ConfigurationManager.AppSettings["YouTubePath"]
                    };
                    mlist.Add(movie);
                }
                return(mlist);
            }
            catch (Exception ex)
            {
                logger.Error(ex);
                throw;
            }
        }
        public void ConnectAPITest1()
        {
            TMDbClient connect = APIConfiguration.ConnectAPI();

            Assert.AreEqual("45b8df4d5d3f51411eb77e2466d7f8f0", connect.ApiKey);
        }