public bool DownloadImages(ApiImageDownloadInfo apiImageDownloadInfo) { try { if (apiImageDownloadInfo == null) return false; bool res = false; if (apiImageDownloadInfo.Source.Contains(_parent.IP)) { _parent.Trace("----------DOWNLOAD IMAGES OKAY checking for presence of Server IP Address in source to select DOwnload Method - Server IP Found"); res = DownloadRemoteImageFile(apiImageDownloadInfo.Source, apiImageDownloadInfo.Destination); } else { res = Download(apiImageDownloadInfo.Source, apiImageDownloadInfo.Destination); } if (res) { if (apiImageDownloadInfo.ToThumb) _parent.GenerateThumb(apiImageDownloadInfo.Destination, apiImageDownloadInfo.Destination, apiImageDownloadInfo.MaxHeight); } return res; } catch (System.Exception ex) { _parent.Log("Exception in Download Images Caught Should continue " + ex); return false; ; } }
public bool DownloadImages(ApiImageDownloadInfo apiImageDownloadInfo) { var res = Download(apiImageDownloadInfo.Source, apiImageDownloadInfo.Destination); if (res) { if (apiImageDownloadInfo.ToThumb) _parent.GenerateThumb(apiImageDownloadInfo.Destination, apiImageDownloadInfo.Destination, apiImageDownloadInfo.MaxHeight); } return res; }
public void AsyncDownloadImages(ApiImageDownloadInfo[] apiImageDownloadInfos) { if (apiImageDownloadInfos.Length < 1) return; _isDownloading = true; var bw = new BackgroundWorker(); bw.DoWork += AsyncImagesDownloadsWorker; bw.RunWorkerAsync(apiImageDownloadInfos); }
public bool DownloadImagesNEW(ApiImageDownloadInfo apiImageDownloadInfo) { if (apiImageDownloadInfo == null) return false; var res = DownloadRemoteImageFile(apiImageDownloadInfo.Source, apiImageDownloadInfo.Destination); if (res) { if (apiImageDownloadInfo.ToThumb) _parent.GenerateThumb(apiImageDownloadInfo.Destination, apiImageDownloadInfo.Destination, apiImageDownloadInfo.MaxHeight); } return res; }
public void AsyncDownloadImages(ApiImageDownloadInfo[] apiImageDownloadInfos) { if (apiImageDownloadInfos == null) return; if (apiImageDownloadInfos.Length < 1) return; _workerDownloads.CancelAsync(); while (_workerDownloads.IsBusy) { Thread.Sleep(50); System.Windows.Forms.Application.DoEvents(); } _isDownloading = true; _workerDownloads.RunWorkerAsync(apiImageDownloadInfos); }
public bool DownloadImages(ApiImageDownloadInfo apiImageDownloadInfo) { try { if (apiImageDownloadInfo == null) return false; bool res = false; if (apiImageDownloadInfo.Source.Contains(_parent.IP)) { _parent.Trace("----------DOWNLOAD IMAGES: Checking for presence of Server IP Address in source to select Download Method - Server IP Found"); _parent.Trace("----------DOWNLOAD IMAGES: Source:" + apiImageDownloadInfo.Source.ToString() + ":Destination:"+ apiImageDownloadInfo.Destination.ToString()); res = DownloadRemoteImageFile(apiImageDownloadInfo.Source, apiImageDownloadInfo.Destination); } else { res = Download(apiImageDownloadInfo.Source, apiImageDownloadInfo.Destination); } if (res) { if (apiImageDownloadInfo.ToThumb) _parent.GenerateThumb(apiImageDownloadInfo.Destination, apiImageDownloadInfo.Destination, apiImageDownloadInfo.MaxHeight); } return res; } catch (System.Exception ex) { _parent.Log("Download Image: Does not Exist:" + ex); // Maybe add this check log first -- apiImageDownloadInfo.Source = "NONE"; return false; ; } }
private void RefreshTFTvSeasons(ref List<ApiImageDownloadInfo> dlinfo) { var lines = _database.GetTvSeason(_remoteInfo.Id); foreach (var line in lines) { if (line.Thumb != "NONE" && !String.IsNullOrEmpty(line.Thumb)) { var path = Helper.CachePath + @"Video\Thumbs\" + _remotePlugin.GetHashFromFileName(line.Thumb) + ".jpg"; if (!File.Exists(path)) { var info = new ApiImageDownloadInfo { Destination = path, Source = line.Thumb, ToThumb = _config.CropCacheImage, MaxHeight = (int)Height / 2 }; dlinfo.Add(info); } } if (line.Fanart != "NONE" && !String.IsNullOrEmpty(line.Fanart)) { var path = Helper.CachePath + @"Video\Fanarts\" + _remotePlugin.GetHashFromFileName(line.Fanart) + ".jpg"; if (!File.Exists(path)) { var info = new ApiImageDownloadInfo { Destination = path, Source = line.Fanart, ToThumb = _config.CropCacheImage, MaxHeight = (int)Height }; dlinfo.Add(info); } } } }
private void RefreshTFTvShows(ref List<ApiImageDownloadInfo> dlinfo) { var lines = _database.GetTvShow(_remoteInfo.Id); Logger.Instance().LogDump("FrontView+", "Start RefresTFTTvShows : Banners TV SHows:" + lines.Count); foreach (var line in lines) { if (line.Thumb != "NONE" && !String.IsNullOrEmpty(line.Thumb)) { var path = Helper.CachePath + @"Video\Thumbs\" + _remotePlugin.GetHashFromFileName(line.Thumb) + ".jpg"; if (!File.Exists(path)) { var info = new ApiImageDownloadInfo { Destination = path, Source = line.Thumb, ToThumb = _config.CropCacheImage, MaxHeight = (int)Height / 2 }; dlinfo.Add(info); } } if (line.Fanart != "NONE" && !String.IsNullOrEmpty(line.Fanart)) { var path = Helper.CachePath + @"Video\Fanarts\" + _remotePlugin.GetHashFromFileName(line.Fanart) + ".jpg"; if (!File.Exists(path)) { var info = new ApiImageDownloadInfo { Destination = path, Source = line.Fanart, ToThumb = _config.CropCacheImage, MaxHeight = (int)Height }; dlinfo.Add(info); } } if (line.Banner != "NONE" && !String.IsNullOrEmpty(line.Banner)) { Logger.Instance().LogDump("FrontView+", "Start Refresh : Banners TV SHows:"+line.Banner); var path = Helper.CachePath + @"Video\Banners\" + _remotePlugin.GetHashFromFileName(line.Banner) + ".jpg"; if (!File.Exists(path)) { var info = new ApiImageDownloadInfo { Destination = path, Source = line.Banner, ToThumb = _config.CropCacheImage, MaxHeight = (int)Height }; dlinfo.Add(info); } } if (line.Logo != "NONE" && !String.IsNullOrEmpty(line.Logo)) { Logger.Instance().LogDump("FrontView+", "Start Refresh : Logos TV SHows:" + line.Logo); var path = Helper.CachePath + @"Video\Logos\" + _remotePlugin.GetHashFromFileName(line.Logo) + ".jpg"; if (!File.Exists(path)) { var info = new ApiImageDownloadInfo { Destination = path, Source = line.Logo, ToThumb = _config.CropCacheImage, MaxHeight = (int)Height }; dlinfo.Add(info); } } } }
private void RefreshTFAudioAlbums(ref List<ApiImageDownloadInfo> dlinfo) { var lines = _database.GetAudioAlbum(_remoteInfo.Id); foreach (var line in lines) { if (line.Thumb == "NONE" || String.IsNullOrEmpty(line.Thumb)) continue; var path = Helper.CachePath + @"Music\Thumbs\" + _remotePlugin.GetHashFromFileName(line.Thumb) + ".jpg"; if (File.Exists(path)) continue; var info = new ApiImageDownloadInfo { Destination = path, Source = line.Thumb, ToThumb = _config.CropCacheImage, MaxHeight = (int)Height/2 }; dlinfo.Add(info); } }