Example #1
0
        /// <summary>
        /// Search for movies by name given in <paramref name="title"/>.
        /// </summary>
        /// <param name="title">Full or partly name of movie</param>
        /// <returns>List of possible matches</returns>
        public async Task <List <OmDbSearchItem> > SearchMovieAsync(string title, int year)
        {
            string           url     = GetUrl(URL_QUERYMOVIE, year, false, false, HttpUtility.UrlEncode(title));
            OmDbSearchResult results = await _downloader.DownloadAsync <OmDbSearchResult>(url).ConfigureAwait(false);

            if (results.ResponseValid == false)
            {
                return(null);
            }
            foreach (OmDbSearchItem item in results.SearchResults)
            {
                item.AssignProperties();
            }
            return(results.SearchResults);
        }
Example #2
0
        /// <summary>
        /// Search for series by name given in <paramref name="title"/>.
        /// </summary>
        /// <param name="title">Full or partly name of series</param>
        /// <returns>List of possible matches</returns>
        public List <OmDbSearchItem> SearchSeries(string title, int year)
        {
            string           url     = GetUrl(URL_QUERYSERIES, year, false, false, HttpUtility.UrlEncode(title));
            OmDbSearchResult results = _downloader.Download <OmDbSearchResult>(url);

            if (results.ResponseValid == false)
            {
                return(null);
            }
            foreach (OmDbSearchItem item in results.SearchResults)
            {
                item.AssignProperties();
            }
            return(results.SearchResults);
        }