示例#1
0
        public void DownloadTvDBPoster(TvDB_ImagePosterVM poster, bool forceDownload)
        {
            if (string.IsNullOrEmpty(poster.BannerPath))
            {
                return;
            }

            try
            {
                string url      = string.Format(Constants.URLS.TvDB_Images, poster.BannerPath);
                string filename = poster.FullImagePath;

                ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.TvDB_Cover, poster, forceDownload);

                // check if this file has already been downloaded and exists
                if (!req.ForceDownload)
                {
                    // check to make sure the file actually exists
                    if (!File.Exists(poster.FullImagePath))
                    {
                        this.imagesToDownload.Enqueue(req);
                        OnQueueUpdateEvent(new QueueUpdateEventArgs(this.QueueCount));
                        return;
                    }

                    // the file exists so don't download it again
                    return;
                }

                this.imagesToDownload.Enqueue(req);
                OnQueueUpdateEvent(new QueueUpdateEventArgs(this.QueueCount));
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
示例#2
0
        private string GetEntityID(ImageDownloadRequest req)
        {
            switch (req.ImageType)
            {
            case ImageEntityType.AniDB_Cover:

                AniDB_AnimeVM anime = req.ImageData as AniDB_AnimeVM;
                return(anime.AnimeID.ToString());

            case ImageEntityType.TvDB_Cover:

                TvDB_ImagePosterVM poster = req.ImageData as TvDB_ImagePosterVM;
                return(poster.TvDB_ImagePosterID.ToString());

            case ImageEntityType.TvDB_Banner:

                TvDB_ImageWideBannerVM banner = req.ImageData as TvDB_ImageWideBannerVM;
                return(banner.TvDB_ImageWideBannerID.ToString());

            case ImageEntityType.TvDB_Episode:

                TvDB_EpisodeVM episode = req.ImageData as TvDB_EpisodeVM;
                return(episode.TvDB_EpisodeID.ToString());

            case ImageEntityType.TvDB_FanArt:

                TvDB_ImageFanartVM fanart = req.ImageData as TvDB_ImageFanartVM;
                return(fanart.TvDB_ImageFanartID.ToString());

            case ImageEntityType.MovieDB_Poster:

                MovieDB_PosterVM moviePoster = req.ImageData as MovieDB_PosterVM;
                return(moviePoster.MovieDB_PosterID.ToString());

            case ImageEntityType.MovieDB_FanArt:

                MovieDB_FanartVM movieFanart = req.ImageData as MovieDB_FanartVM;
                return(movieFanart.MovieDB_FanartID.ToString());

            case ImageEntityType.Trakt_Poster:

                Trakt_ImagePosterVM traktPoster = req.ImageData as Trakt_ImagePosterVM;
                return(traktPoster.Trakt_ImagePosterID.ToString());

            case ImageEntityType.Trakt_Fanart:

                Trakt_ImageFanartVM trakFanart = req.ImageData as Trakt_ImageFanartVM;
                return(trakFanart.Trakt_ImageFanartID.ToString());

            case ImageEntityType.Trakt_CommentUser:

                Trakt_CommentUserVM traktShoutUser = req.ImageData as Trakt_CommentUserVM;
                return(traktShoutUser.User.Trakt_FriendID.ToString());

            case ImageEntityType.Trakt_Episode:

                Trakt_EpisodeVM trakEp = req.ImageData as Trakt_EpisodeVM;
                return(trakEp.Trakt_EpisodeID.ToString());

            case ImageEntityType.AniDB_Character:

                AniDB_CharacterVM chr = req.ImageData as AniDB_CharacterVM;
                return(chr.AniDB_CharacterID.ToString());

            case ImageEntityType.AniDB_Creator:

                AniDB_SeiyuuVM cre = req.ImageData as AniDB_SeiyuuVM;
                return(cre.AniDB_SeiyuuID.ToString());

            default:
                return("");
            }
        }
示例#3
0
        private string GetFileName(ImageDownloadRequest req, bool thumbNailOnly)
        {
            switch (req.ImageType)
            {
            case ImageEntityType.AniDB_Cover:

                AniDB_AnimeVM anime = req.ImageData as AniDB_AnimeVM;
                return(anime.PosterPathNoDefaultPlain);

            case ImageEntityType.TvDB_Cover:

                TvDB_ImagePosterVM poster = req.ImageData as TvDB_ImagePosterVM;
                return(poster.FullImagePathPlain);

            case ImageEntityType.TvDB_Banner:

                TvDB_ImageWideBannerVM banner = req.ImageData as TvDB_ImageWideBannerVM;
                return(banner.FullImagePathPlain);

            case ImageEntityType.TvDB_Episode:

                TvDB_EpisodeVM episode = req.ImageData as TvDB_EpisodeVM;
                return(episode.FullImagePathPlain);

            case ImageEntityType.TvDB_FanArt:

                TvDB_ImageFanartVM fanart = req.ImageData as TvDB_ImageFanartVM;

                if (thumbNailOnly)
                {
                    return(fanart.FullThumbnailPathPlain);
                }
                else
                {
                    return(fanart.FullImagePathPlain);
                }

            case ImageEntityType.MovieDB_Poster:

                MovieDB_PosterVM moviePoster = req.ImageData as MovieDB_PosterVM;
                return(moviePoster.FullImagePathPlain);

            case ImageEntityType.MovieDB_FanArt:

                MovieDB_FanartVM movieFanart = req.ImageData as MovieDB_FanartVM;
                return(movieFanart.FullImagePathPlain);

            case ImageEntityType.Trakt_Poster:

                Trakt_ImagePosterVM traktPoster = req.ImageData as Trakt_ImagePosterVM;
                return(traktPoster.FullImagePathPlain);

            case ImageEntityType.Trakt_Fanart:

                Trakt_ImageFanartVM trakFanart = req.ImageData as Trakt_ImageFanartVM;
                return(trakFanart.FullImagePathPlain);

            case ImageEntityType.Trakt_Episode:

                Trakt_EpisodeVM trakEp = req.ImageData as Trakt_EpisodeVM;
                return(trakEp.FullImagePathPlain);

            case ImageEntityType.AniDB_Character:

                AniDB_CharacterVM chr = req.ImageData as AniDB_CharacterVM;
                return(chr.ImagePathPlain);

            case ImageEntityType.AniDB_Creator:

                AniDB_SeiyuuVM cre = req.ImageData as AniDB_SeiyuuVM;
                return(cre.ImagePathPlain);

            default:
                return("");
            }
        }
示例#4
0
        private string GetEntityID(ImageDownloadRequest req)
        {
            switch (req.ImageType)
            {
            case ImageEntityType.AniDB_Cover:

                AniDB_AnimeVM anime = req.ImageData as AniDB_AnimeVM;
                return(anime.AnimeID.ToString());

            case ImageEntityType.TvDB_Cover:

                TvDB_ImagePosterVM poster = req.ImageData as TvDB_ImagePosterVM;
                return(poster.TvDB_ImagePosterID.ToString());

            case ImageEntityType.TvDB_Banner:

                TvDB_ImageWideBannerVM banner = req.ImageData as TvDB_ImageWideBannerVM;
                return(banner.TvDB_ImageWideBannerID.ToString());

            case ImageEntityType.TvDB_Episode:

                TvDB_EpisodeVM episode = req.ImageData as TvDB_EpisodeVM;
                return(episode.TvDB_EpisodeID.ToString());

            case ImageEntityType.TvDB_FanArt:

                TvDB_ImageFanartVM fanart = req.ImageData as TvDB_ImageFanartVM;
                return(fanart.TvDB_ImageFanartID.ToString());

            case ImageEntityType.MovieDB_Poster:

                MovieDB_PosterVM moviePoster = req.ImageData as MovieDB_PosterVM;
                return(moviePoster.MovieDB_PosterID.ToString());

            case ImageEntityType.MovieDB_FanArt:

                MovieDB_FanartVM movieFanart = req.ImageData as MovieDB_FanartVM;
                return(movieFanart.MovieDB_FanartID.ToString());

            case ImageEntityType.Trakt_Poster:

                Trakt_ImagePosterVM traktPoster = req.ImageData as Trakt_ImagePosterVM;
                return(traktPoster.Trakt_ImagePosterID.ToString());

            case ImageEntityType.Trakt_Fanart:

                Trakt_ImageFanartVM trakFanart = req.ImageData as Trakt_ImageFanartVM;
                return(trakFanart.Trakt_ImageFanartID.ToString());

            case ImageEntityType.Trakt_Friend:

                Trakt_FriendVM trakFriend = req.ImageData as Trakt_FriendVM;
                return(trakFriend.Trakt_FriendID.ToString());

            case ImageEntityType.Trakt_ActivityScrobble:

                Trakt_ActivityScrobbleVM trakScrobble = req.ImageData as Trakt_ActivityScrobbleVM;
                return(trakScrobble.User.Trakt_FriendID.ToString());

            case ImageEntityType.Trakt_ShoutUser:

                Trakt_ShoutUserVM traktShoutUser = req.ImageData as Trakt_ShoutUserVM;
                return(traktShoutUser.User.Trakt_FriendID.ToString());

            case ImageEntityType.Trakt_Episode:

                Trakt_EpisodeVM trakEp = req.ImageData as Trakt_EpisodeVM;
                return(trakEp.Trakt_EpisodeID.ToString());

            case ImageEntityType.Trakt_WatchedEpisode:

                Trakt_WatchedEpisodeVM trakwEp = req.ImageData as Trakt_WatchedEpisodeVM;
                return(trakwEp.Trakt_EpisodeID.ToString());

            default:
                return("");
            }
        }
示例#5
0
        private string GetFileName(ImageDownloadRequest req, bool thumbNailOnly)
        {
            switch (req.ImageType)
            {
            case ImageEntityType.AniDB_Cover:

                AniDB_AnimeVM anime = req.ImageData as AniDB_AnimeVM;
                return(anime.PosterPathNoDefaultPlain);

            case ImageEntityType.TvDB_Cover:

                TvDB_ImagePosterVM poster = req.ImageData as TvDB_ImagePosterVM;
                return(poster.FullImagePathPlain);

            case ImageEntityType.TvDB_Banner:

                TvDB_ImageWideBannerVM banner = req.ImageData as TvDB_ImageWideBannerVM;
                return(banner.FullImagePathPlain);

            case ImageEntityType.TvDB_Episode:

                TvDB_EpisodeVM episode = req.ImageData as TvDB_EpisodeVM;
                return(episode.FullImagePathPlain);

            case ImageEntityType.TvDB_FanArt:

                TvDB_ImageFanartVM fanart = req.ImageData as TvDB_ImageFanartVM;

                if (thumbNailOnly)
                {
                    return(fanart.FullThumbnailPathPlain);
                }
                else
                {
                    return(fanart.FullImagePathPlain);
                }

            case ImageEntityType.MovieDB_Poster:

                MovieDB_PosterVM moviePoster = req.ImageData as MovieDB_PosterVM;
                return(moviePoster.FullImagePathPlain);

            case ImageEntityType.MovieDB_FanArt:

                MovieDB_FanartVM movieFanart = req.ImageData as MovieDB_FanartVM;
                return(movieFanart.FullImagePathPlain);

            case ImageEntityType.Trakt_Poster:

                Trakt_ImagePosterVM traktPoster = req.ImageData as Trakt_ImagePosterVM;
                return(traktPoster.FullImagePathPlain);

            case ImageEntityType.Trakt_Fanart:

                Trakt_ImageFanartVM trakFanart = req.ImageData as Trakt_ImageFanartVM;
                return(trakFanart.FullImagePathPlain);

            case ImageEntityType.Trakt_Friend:

                Trakt_FriendVM trakFriend = req.ImageData as Trakt_FriendVM;
                return(trakFriend.FullImagePathPlain);

            case ImageEntityType.Trakt_ActivityScrobble:

                Trakt_ActivityScrobbleVM trakScrobble = req.ImageData as Trakt_ActivityScrobbleVM;
                return(trakScrobble.UserFullImagePathPlain);

            case ImageEntityType.Trakt_ShoutUser:

                Trakt_ShoutUserVM trakShoutUser = req.ImageData as Trakt_ShoutUserVM;
                return(trakShoutUser.UserFullImagePathPlain);

            case ImageEntityType.Trakt_Episode:

                Trakt_EpisodeVM trakEp = req.ImageData as Trakt_EpisodeVM;
                return(trakEp.FullImagePathPlain);

            case ImageEntityType.Trakt_WatchedEpisode:

                Trakt_WatchedEpisodeVM trakwEp = req.ImageData as Trakt_WatchedEpisodeVM;
                return(trakwEp.FullImagePathPlain);

            default:
                return("");
            }
        }