示例#1
0
        /// <summary>
        /// Get the small episode image.
        /// </summary>
        /// <param name="instance">An API instance.</param>
        /// <param name="fileName">The output filename.</param>
        /// <returns>True if the images is downloaded; false otherwise.</returns>
        public bool GetSmallImage(TvdbAPI instance, string fileName)
        {
            if (string.IsNullOrWhiteSpace(Image))
            {
                return(false);
            }

            return(instance.GetImage(TvdbAPI.ImageType.SmallPoster, Image, 0, fileName));
        }
示例#2
0
        /// <summary>
        /// Get the banner image.
        /// </summary>
        /// <param name="instance">The API instance.</param>
        /// <param name="fileName">The name of the output file.</param>
        /// <returns>True if the banner was downloaded; false otherwise.</returns>
        public bool GetBannerImage(TvdbAPI instance, string fileName)
        {
            if (string.IsNullOrWhiteSpace(Banner))
            {
                return(false);
            }

            return(instance.GetImage(TvdbAPI.ImageType.Banner, Banner, 0, fileName));
        }
示例#3
0
        /// <summary>
        /// Get the small image for the actor.
        /// </summary>
        /// <param name="instance">An API instance.</param>
        /// <param name="fileName">The name of the file to hold te image.</param>
        /// <returns>True if the image has been downloaded; false otherwise.</returns>
        public bool GetSmallImage(TvdbAPI instance, string fileName)
        {
            if (Image == null || Image.Length == 0)
            {
                return(false);
            }

            instance.GetImage(TvdbAPI.ImageType.SmallActor, Image, 0, fileName);

            return(true);
        }
示例#4
0
        /// <summary>
        /// Get a banner image.
        /// </summary>
        /// <param name="instance">The API instance.</param>
        /// <param name="index">The index of the image.</param>
        /// <param name="fileName">The name of the output file.</param>
        /// <param name="languageCode">The language code.</param>
        /// <returns>True if the banner was downloaded; false otherwise.</returns>
        public bool GetBannerImage(TvdbAPI instance, int index, string fileName, string languageCode = null)
        {
            LoadBanners(instance, languageCode);

            if (Banners == null || Banners.Count == 0 || index == -1 || index >= Banners.Count)
            {
                return(false);
            }

            if (string.IsNullOrWhiteSpace(Banners[index].FileName))
            {
                return(false);
            }

            return(instance.GetImage(TvdbAPI.ImageType.Banner, Banners[index].FileName, 0, fileName));
        }
示例#5
0
        /// <summary>
        /// Get the small fan art image.
        /// </summary>
        /// <param name="instance">An API instance.</param>
        /// <param name="fileName">The output filename.</param>
        /// <returns>True if the image was downloaded; false otherwise.</returns>
        public bool GetSmallFanArtImage(TvdbAPI instance, string fileName)
        {
            TvdbBanner selectedBanner = findBanner(instance, TvdbAPI.ImageType.FanArt, true);

            if (selectedBanner == null)
            {
                return(false);
            }

            try
            {
                return(instance.GetImage(TvdbAPI.ImageType.FanArt, selectedBanner.ThumbNail, 0, fileName));
            }
            catch (WebException e)
            {
                HttpWebResponse response = e.Response as HttpWebResponse;
                if (response != null && response.StatusCode == HttpStatusCode.NotFound)
                {
                    return(false);
                }
                throw e;
            }
        }