示例#1
0
        static void Main(string[] args)
        {
            //http://www.omdbapi.com/apikey.aspx

            var api = new OmdbApiClient("");

            var goodAnswer = api.GetItemByID("tt0111161");

            Debug.Assert(goodAnswer != null);

            Console.WriteLine("OK:" + goodAnswer.Title);

            try
            {
                var incorrectimdbId = api.GetItemByID("tt111161");
            }
            catch (OmdbAPiException e)
            {
                Console.WriteLine(e.Message);
            }

            var noData = api.GetItemByID("tt9999999");

            Debug.Assert(noData == null);

            Console.ReadKey();
        }
示例#2
0
        public static void Main(string[] args)
        {
            BuildLogger();
            BuildConfig();
            BuildMapper();
            BuildTitleService();

            var parser      = new OmdbApiClient(_config, _mapper);
            var omdbGrabber = new OmdbGrabber(parser, _titleService, _log);

            for (int i = 0; i < 3; i++)
            {
                omdbGrabber.GrabByImdbIds(args.Length > 0 ? args : ImdbIds.AmericanDadAllEpisodes);
            }

            Console.WriteLine("Done!");
            Console.ReadLine();
        }
示例#3
0
 private OmdbApiClient GetOmdbApiClient()
 {
     return(_omdbApiClient ?? (_omdbApiClient = new OmdbApiClient(_omdbApiSettings.BaseUrl, _omdbApiSettings.Key)));
 }
示例#4
0
 public OmdbGrabber(OmdbApiClient apiParser, ITitleService titleService, ILog log)
 {
     _apiParser    = apiParser;
     _titleService = titleService;
     _log          = log;
 }
示例#5
0
 public MovieController(OmdbApiClient omdbApiClient)
 {
     this.omdbApiClient = omdbApiClient ?? throw new ArgumentNullException(nameof(omdbApiClient));
 }