public DownloadItem Add(EpisodeWithDownloadSettings ep, string template, string downloadpath,DownloadStatus status=DownloadStatus.Queue) { DownloadItem dinfo = null; lock (_downloadslock) { dinfo = new DownloadItem(ep, template, downloadpath, this, status); dinfo.Index = cnt++; dinfo.OnProgress += ((a) => { if (OnProgress != null) OnProgress(a); }); dinfo.OnFinish += ((a) => { Save(); CheckForDownload(); }); lock (_downloadslock) { _downloads.Add(dinfo); } } CheckForDownload(); return dinfo; }
public DownloadItem Add(EpisodeWithDownloadSettings ep, string template, string downloadpath, DownloadStatus status = DownloadStatus.Queue) { DownloadItem dinfo = null; lock (_downloadslock) { dinfo = new DownloadItem(ep, template, downloadpath, this, status); dinfo.Index = cnt++; dinfo.OnProgress += ((a) => { if (OnProgress != null) { OnProgress(a); } }); dinfo.OnFinish += ((a) => { Save(); CheckForDownload(); }); lock (_downloadslock) { _downloads.Add(dinfo); } } CheckForDownload(); return(dinfo); }
public void AddDownload(EpisodeWithDownloadSettings d) { if (!Downloads.Any(a => a.Id == d.Id && a.PluginName == d.PluginName && a.Quality == d.Quality && a.Format == d.Format)) { Downloads.Add(d); Save(); } }
public static EpisodeWithDownloadSettings FromEpisode(Episode ep, Quality q, Format f) { EpisodeWithDownloadSettings e=new EpisodeWithDownloadSettings(); ep.CopyTo(e); e.Quality = q; e.Format = f; return e; }
public static EpisodeWithDownloadSettings FromEpisode(Episode ep, Quality q, Format f) { EpisodeWithDownloadSettings e = new EpisodeWithDownloadSettings(); ep.CopyTo(e); e.Quality = q; e.Format = f; return(e); }
public DownloadItem(EpisodeWithDownloadSettings ep, string template, string path, DownloadManager manager, DownloadStatus status) { _ep = ep; Status = status; DownloadInfo = new DownloadInfo(); DownloadInfo.FileName = TemplateParser.FilenameFromEpisode(ep, ep.Quality, template); DownloadInfo.FullPath = Path.Combine(path, DownloadInfo.FileName); DownloadInfo.Quality = ep.Quality; DownloadInfo.Format = ep.Format; DownloadInfo.Languages = new List <string>(); DownloadInfo.Status = string.Empty; DownloadInfo.Percent = 0; _template = template; _path = path; Id = Guid.NewGuid().ToString(); _manager = manager; _scheduler = TaskScheduler.FromCurrentSynchronizationContext(); }
public List<EpisodeWithDownloadSettings> CheckFollows(List<Episode> upds) { List <EpisodeWithDownloadSettings> downs=new List<EpisodeWithDownloadSettings>(); foreach (Episode upd in upds) { List<Follow> fls = ShowFollows.Where(a => a.ShowId == upd.ShowId && a.PluginName == upd.PluginName).ToList(); foreach(Follow f in fls.ToList()) { if (!Downloads.Any(a => a.Id == upd.Id && a.PluginName == upd.PluginName && a.Quality == f.Quality && a.Format == f.Format)) { EpisodeWithDownloadSettings his=new EpisodeWithDownloadSettings(); upd.CopyTo(his); his.Format = f.Format; his.Quality = f.Quality; downs.Add(his); } } } return downs; }
public List <EpisodeWithDownloadSettings> CheckFollows(List <Episode> upds) { List <EpisodeWithDownloadSettings> downs = new List <EpisodeWithDownloadSettings>(); foreach (Episode upd in upds) { List <Follow> fls = ShowFollows.Where(a => a.ShowId == upd.ShowId && a.PluginName == upd.PluginName).ToList(); foreach (Follow f in fls.ToList()) { if (!Downloads.Any(a => a.Id == upd.Id && a.PluginName == upd.PluginName && a.Quality == f.Quality && a.Format == f.Format)) { EpisodeWithDownloadSettings his = new EpisodeWithDownloadSettings(); upd.CopyTo(his); his.Format = f.Format; his.Quality = f.Quality; downs.Add(his); } } } return(downs); }