Пример #1
0
        public void DownloadTvDBEpisode(TvDB_Episode episode, bool forceDownload)
        {
            if (string.IsNullOrEmpty(episode.Filename))
            {
                return;
            }

            try
            {
                ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.TvDB_Episode, episode, 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(episode.GetFullImagePathPlain()))
                    {
                        imagesToDownload.Add(req);
                        OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
                        return;
                    }

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

                imagesToDownload.Add(req);
                OnQueueUpdateEvent(new QueueUpdateEventArgs(QueueCount));
            }
            catch (Exception ex)
            {
                BaseConfig.MyAnimeLog.Write(ex.ToString());
            }
        }
Пример #2
0
        public static string GetFullImagePath(this TvDB_Episode tvDbEpisodeVm)
        {
            if (String.IsNullOrEmpty(tvDbEpisodeVm.GetFullImagePathPlain()))
            {
                return(tvDbEpisodeVm.GetFullImagePathPlain());
            }

            if (!File.Exists(tvDbEpisodeVm.GetFullImagePathPlain()))
            {
                ImageDownloadRequest req = new ImageDownloadRequest(ImageEntityType.TvDB_Episode, tvDbEpisodeVm, false);
                MainWindow.imageHelper.DownloadImage(req);
                if (File.Exists(tvDbEpisodeVm.GetFullImagePathPlain()))
                {
                    return(tvDbEpisodeVm.GetFullImagePathPlain());
                }
            }

            return(tvDbEpisodeVm.GetFullImagePathPlain());
        }