public ItemList ForceUpdateEpisode(DownloadIdentifier.DownloadType dt, ProcessedEpisode episode, FileInfo filo) { ItemList theActionList = new ItemList(); foreach (DownloadIdentifier di in identifiers.Where(di => dt == di.GetDownloadType())) { theActionList.Add(di.ProcessEpisode(episode, filo, true)); } return(theActionList); }
public ItemList ProcessSeason(ShowItem si, string folder, int snum) { ItemList TheActionList = new ItemList(); foreach (DownloadIdentifier di in Identifiers) { TheActionList.Add(di.ProcessSeason(si, folder, snum)); } return(TheActionList); }
public ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo) { ItemList TheActionList = new ItemList(); foreach (DownloadIdentifier di in Identifiers) { TheActionList.Add(di.ProcessEpisode(dbep, filo)); } return(TheActionList); }
public ItemList ProcessShow(ShowItem si) { ItemList TheActionList = new ItemList(); foreach (DownloadIdentifier di in Identifiers) { TheActionList.Add(di.ProcessShow(si)); } return(TheActionList); }
protected override void DoCheck(SetProgressDelegate prog, TVDoc.ScanSettings settings) { if (TVSettings.Instance.SearchRSSManualScanOnly && settings.Unattended) { LOGGER.Info("Searching RSS Feeds is cancelled as this is an unattended scan"); return; } int c = ActionList.Missing.Count + 2; int n = 1; UpdateStatus(n, c, "Searching on RSS Feed..."); // ReSharper disable once InconsistentNaming RssItemList RSSList = new RssItemList(); foreach (string s in TVSettings.Instance.RSSURLs) { RSSList.DownloadRSS(s, TVSettings.Instance.RSSUseCloudflare, "RSS"); } ItemList newItems = new ItemList(); ItemList toRemove = new ItemList(); foreach (ShowItemMissing action in ActionList.MissingEpisodes.ToList()) { if (settings.Token.IsCancellationRequested) { return; } UpdateStatus(n++, c, action.Filename); ProcessedEpisode pe = action.MissingEpisode; ItemList newItemsForThisMissingEpisode = new ItemList(); foreach (RSSItem rss in RSSList.Where(rss => RssMatch(rss, pe))) { LOGGER.Info( $"Adding {rss.URL} from RSS feed as it appears to be match for {pe.Show.ShowName} {pe}"); ItemDownloading eventualItem = new ItemDownloading(new FutureTorrentEntry(rss.URL, action.TheFileNoExt), action.MissingEpisode, action.TheFileNoExt, DownloadingFinder.DownloadApp.qBitTorrent, action); newItemsForThisMissingEpisode.Add(new ActionTDownload(rss, action, eventualItem)); toRemove.Add(action); } foreach (ActionTDownload x in FindDuplicates(newItemsForThisMissingEpisode)) { newItemsForThisMissingEpisode.Remove(x); } newItems.AddNullableRange(newItemsForThisMissingEpisode); } ActionList.Replace(toRemove, newItems); }
protected void SearchForAppropriateDownloads(SetProgressDelegate prog, int startpct, int totPct, List <TorrentEntry> downloading, DownloadApp tApp) { ItemList newList = new ItemList(); ItemList toRemove = new ItemList(); int c = ActionList.Count + 2; int n = 1; prog.Invoke(startpct); foreach (ItemMissing action in ActionList.MissingItems()) { if (ActionCancel) { return; } prog.Invoke(startpct + ((totPct - startpct) * (++n) / (c))); foreach (TorrentEntry te in downloading) { FileInfo file = new FileInfo(te.DownloadingTo); if (!TVSettings.Instance.UsefulExtension(file.Extension, false)) // not a usefile file extension { continue; } //do any of the possible names for the series match the filename? bool matched = (action.Episode.Show.GetSimplifiedPossibleShowNames().Any(name => FileHelper.SimplifyAndCheckFilename(file.FullName, name))); if (!matched) { continue; } if (TVDoc.FindSeasEp(file, out int seasF, out int epF, out int _, action.Episode.Show) && (seasF == action.Episode.AppropriateSeasonNumber) && (epF == action.Episode.AppropriateEpNum)) { toRemove.Add(action); newList.Add(new ItemDownloading(te, action.Episode, action.TheFileNoExt, tApp)); break; } } } foreach (Item i in toRemove) { ActionList.Remove(i); } foreach (Item action in newList) { ActionList.Add(action); } prog.Invoke(totPct); }
protected override void DoCheck(SetProgressDelegate prog, ICollection <ShowItem> showList, TVDoc.ScanSettings settings) { if (string.IsNullOrEmpty(TVSettings.Instance.SABAPIKey) || string.IsNullOrEmpty(TVSettings.Instance.SABHostPort)) { LOGGER.Info("Searching SABnzxdb Feeds is cancelled as the key and host/port are notprovided in Preferences."); return; } // get list of files being downloaded by SABnzbd XElement x = GetSabDownload(TVSettings.Instance.SABAPIKey, TVSettings.Instance.SABHostPort); if (x is null) { return; } ItemList newList = new ItemList(); ItemList toRemove = new ItemList(); int c = ActionList.MissingItems().Count() + 1; int n = 0; foreach (ItemMissing action in ActionList.MissingItems().ToList()) { if (settings.Token.IsCancellationRequested) { return; } UpdateStatus(n++, c, action.Filename); if (action.Episode?.Show is null) { continue; } string simpleShowName = Helpers.SimplifyName(action.Episode.Show.ShowName); if (string.IsNullOrWhiteSpace(simpleShowName)) { continue; } foreach (QueueSlotsSlot te in x.Descendants("slots").Select(slot => CreateQueueSlotsSlot(slot, simpleShowName, action)).Where(te => !(te is null))) { toRemove.Add(action); newList.Add(new ItemDownloading(te, action.Episode, action.TheFileNoExt, DownloadApp.SABnzbd)); break; } } ActionList.Replace(toRemove, newList); }
public ItemList ForceUpdateSeason(DownloadIdentifier.DownloadType dt, ShowItem si, string folder, int snum) { ItemList TheActionList = new ItemList(); foreach (DownloadIdentifier di in this.Identifiers) { if (dt == di.GetDownloadType()) { TheActionList.Add(di.ProcessSeason(si, folder, snum, true)); } } return(TheActionList); }
public ItemList ForceUpdateShow(DownloadIdentifier.DownloadType dt, ShowItem si) { ItemList TheActionList = new ItemList(); foreach (DownloadIdentifier di in this.Identifiers) { if (dt == di.GetDownloadType()) { TheActionList.Add(di.ProcessShow(si, true)); } } return(TheActionList); }
public ItemList ForceUpdateEpisode(DownloadIdentifier.DownloadType dt, ProcessedEpisode dbep, FileInfo filo) { ItemList TheActionList = new ItemList(); foreach (DownloadIdentifier di in this.Identifiers) { if (dt == di.GetDownloadType()) { TheActionList.Add(di.ProcessEpisode(dbep, filo, true)); } } return(TheActionList); }
public ItemList ProcessShow([CanBeNull] ShowItem si) { ItemList theActionList = new ItemList(); if (si is null) { return(theActionList); } foreach (DownloadIdentifier di in identifiers) { theActionList.Add(di.ProcessShow(si)); } return(theActionList); }
public ItemList ProcessSeason([CanBeNull] ShowItem si, string folder, int snum) { ItemList theActionList = new ItemList(); if (si is null) { return(theActionList); } foreach (DownloadIdentifier di in identifiers) { theActionList.Add(di.ProcessSeason(si, folder, snum)); } return(theActionList); }
public ItemList ProcessMovie(MovieConfiguration?si, FileInfo filo) { if (si is null) { return(new ItemList()); } ItemList theActionList = new ItemList(); foreach (DownloadIdentifier di in identifiers) { theActionList.Add(di.ProcessMovie(si, filo)); } return(theActionList); }
public ItemList ProcessEpisode([CanBeNull] ProcessedEpisode dbep, FileInfo filo) { ItemList theActionList = new ItemList(); if (dbep is null) { return(theActionList); } foreach (DownloadIdentifier di in identifiers) { theActionList.Add(di.ProcessEpisode(dbep, filo)); } return(theActionList); }
public ItemList?ProcessEpisode(ProcessedEpisode?episode, FileInfo filo) { if (episode is null) { return(null); } ItemList theActionList = new ItemList(); foreach (DownloadIdentifier di in identifiers) { theActionList.Add(di.ProcessEpisode(episode, filo)); } return(theActionList); }
public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh) { if (TVSettings.Instance.EpTBNs || TVSettings.Instance.KODIImages) { ItemList theActionList = new ItemList(); if (dbep.type == ProcessedEpisode.ProcessedEpisodeType.merged) { //We have a merged episode, so we'll also download the images for the episodes had they been separate. foreach (Episode sourceEp in dbep.sourceEpisodes) { string foldername = filo.DirectoryName; string filename = TVSettings.Instance.FilenameFriendly( TVSettings.Instance.NamingStyle.GetTargetEpisodeName(sourceEp, dbep.SI.ShowName, dbep.SI.GetTimeZone(), dbep.SI.DVDOrder)); ActionDownloadImage b = DoEpisode(dbep.SI, sourceEp, new FileInfo(foldername + "/" + filename), ".jpg", forceRefresh); if (b != null) { theActionList.Add(b); } } } else { ActionDownloadImage a = DoEpisode(dbep.SI, dbep, filo, ".tbn", forceRefresh); if (a != null) { theActionList.Add(a); } } return(theActionList); } return(base.ProcessEpisode(dbep, filo, forceRefresh)); }
public override ItemList ProcessShow(ShowItem si, bool forceRefresh) { if (TVSettings.Instance.wdLiveTvMeta) { ItemList theActionList = new ItemList(); FileInfo tvshowxml = FileHelper.FileInFolder(si.AutoAddFolderBase, "series.xml"); bool needUpdate = !tvshowxml.Exists || (si.TheSeries().SrvLastUpdated > TimeZone.Epoch(tvshowxml.LastWriteTime)); if ((forceRefresh || needUpdate) && (!doneFiles.Contains(tvshowxml.FullName))) { doneFiles.Add(tvshowxml.FullName); theActionList.Add(new ActionWdtvMeta(tvshowxml, si)); } return(theActionList); } return(base.ProcessShow(si, forceRefresh)); }
protected override void DoCheck(SetProgressDelegate prog, ICollection <ShowItem> shows, TVDoc.ScanSettings settings) { returnActions = new ItemList(); showList = MDoc.Library.GetShowItems(); //We ignore the current set of shows being scanned to be secrure that no files are deleted for unscanned shows currentSettings = settings; //for each directory in settings directory //for each file in directory //for each saved show (order by recent) //is file already available? //if so add show to list of files to be removed int totalDownloadFolders = TVSettings.Instance.DownloadFolders.Count; int c = 0; foreach (string dirPath in TVSettings.Instance.DownloadFolders.ToList()) { UpdateStatus(c++, totalDownloadFolders, dirPath); if (!Directory.Exists(dirPath) || currentSettings.Token.IsCancellationRequested) { continue; } filesThatMayBeNeeded = new List <FileInfo>(); ReviewFilesInDownloadDirectory(dirPath); ReviewDirsInDownloadDirectory(dirPath); } ItemList removeActions = new ItemList(); //Remove any missing items we are planning to resolve foreach (ActionCopyMoveRename acmr in returnActions.OfType <ActionCopyMoveRename>()) { foreach (ItemMissing missingItem in MDoc.TheActionList.MissingItems()) { if (missingItem.Episode == acmr.Episode) { removeActions.Add(missingItem); } } } MDoc.TheActionList.Replace(removeActions, returnActions); }
public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh) { if (TVSettings.Instance.Mede8erXML) { ItemList TheActionList = new ItemList(); string fn = filo.RemoveExtension() + ".xml"; FileInfo nfo = FileHelper.FileInFolder(filo.Directory, fn); if (forceRefresh || !nfo.Exists || (dbep.Srv_LastUpdated > TimeZone.Epoch(nfo.LastWriteTime))) { TheActionList.Add(new ActionMede8erXML(nfo, dbep)); } return(TheActionList); } return(base.ProcessEpisode(dbep, filo, forceRefresh)); }
public ItemList ForceUpdateMovie(DownloadIdentifier.DownloadType dt, MovieConfiguration?si, FileInfo filo) { ItemList theActionList = new ItemList(); if (si is null) { return(theActionList); } foreach (DownloadIdentifier di in identifiers) { if (dt == di.GetDownloadType()) { theActionList.Add(di.ProcessMovie(si, filo, true)); } } return(theActionList); }
public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh) { if (!TVSettings.Instance.Mede8erXML) { return(null); } ItemList theActionList = new ItemList(); //Updates requested by [email protected] on 18/4/2013 FileInfo viewxml = FileHelper.FileInFolder(folder, "View.xml"); if (!viewxml.Exists) { theActionList.Add(new ActionMede8erViewXML(viewxml, si, snum)); } return(theActionList); }
public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh) { if (!TVSettings.Instance.wdLiveTvMeta) { return(null); } ItemList theActionList = new ItemList(); string fn = filo.RemoveExtension() + ".xml"; FileInfo nfo = FileHelper.FileInFolder(filo.Directory, fn); if (forceRefresh || !nfo.Exists || (dbep.SrvLastUpdated > TimeZoneHelper.Epoch(nfo.LastWriteTime))) { theActionList.Add(new ActionWdtvMeta(nfo, dbep)); } return(theActionList); }
public ItemList ForceUpdateShow(DownloadIdentifier.DownloadType dt, ShowConfiguration?si) { ItemList theActionList = new ItemList(); if (si is null) { return(theActionList); } foreach (DownloadIdentifier di in identifiers) { if (dt == di.GetDownloadType()) { theActionList.Add(di.ProcessShow(si, true)); } } return(theActionList); }
public override ItemList?ProcessEpisode(ProcessedEpisode episode, FileInfo file, bool forceRefresh) { if (!TVSettings.Instance.Mede8erXML) { return(null); } ItemList theActionList = new ItemList(); string fn = file.RemoveExtension() + ".xml"; FileInfo nfo = FileHelper.FileInFolder(file.Directory, fn); if (forceRefresh || !nfo.Exists || episode.SrvLastUpdated > TimeZoneHelper.Epoch(nfo.LastWriteTime)) { theActionList.Add(new ActionMede8erXML(nfo, episode)); } return(theActionList); }
public ItemList ForceUpdateEpisode(DownloadIdentifier.DownloadType dt, [CanBeNull] ProcessedEpisode dbep, FileInfo filo) { ItemList theActionList = new ItemList(); if (dbep is null) { return(theActionList); } foreach (DownloadIdentifier di in identifiers) { if (dt == di.GetDownloadType()) { theActionList.Add(di.ProcessEpisode(dbep, filo, true)); } } return(theActionList); }
public ItemList ForceUpdateSeason(DownloadIdentifier.DownloadType dt, [CanBeNull] ShowItem si, string folder, int snum) { ItemList theActionList = new ItemList(); if (si is null) { return(theActionList); } foreach (DownloadIdentifier di in identifiers) { if (dt == di.GetDownloadType()) { theActionList.Add(di.ProcessSeason(si, folder, snum, true)); } } return(theActionList); }
protected void SearchForAppropriateDownloads(List <TorrentEntry> downloading, DownloadApp tApp, TVDoc.ScanSettings settings) { ItemList newList = new ItemList(); ItemList toRemove = new ItemList(); int c = ActionList.MissingItems().Count() + 2; int n = 1; UpdateStatus(n, c, "Searching torrent queue..."); foreach (ItemMissing action in ActionList.MissingItems().ToList()) { if (settings.Token.IsCancellationRequested) { return; } UpdateStatus(n++, c, action.Filename); foreach (TorrentEntry te in downloading) { FileInfo file = new FileInfo(te.DownloadingTo); if (!file.IsMovieFile()) // not a usefile file extension { continue; } //do any of the possible names for the series match the filename? bool matched = action.Episode.Show.NameMatch(file, true); if (!matched) { continue; } if (FinderHelper.FindSeasEp(file, out int seasF, out int epF, out int _, action.Episode.Show) && (seasF == action.Episode.AppropriateSeasonNumber) && (epF == action.Episode.AppropriateEpNum)) { toRemove.Add(action); newList.Add(new ItemDownloading(te, action.Episode, action.TheFileNoExt, tApp)); break; } } } ActionList.Replace(toRemove, newList); }
public override ItemList?ProcessShow(ShowConfiguration si, bool forceRefresh) { if (TVSettings.Instance.wdLiveTvMeta) { ItemList theActionList = new ItemList(); FileInfo tvShowXml = FileHelper.FileInFolder(si.AutoAddFolderBase, "cachedSeries.xml"); CachedSeriesInfo cachedSeriesInfo = si.CachedShow; bool needUpdate = !tvShowXml.Exists || cachedSeriesInfo is null || cachedSeriesInfo.SrvLastUpdated > TimeZoneHelper.Epoch(tvShowXml.LastWriteTime); if ((forceRefresh || needUpdate) && !doneFiles.Contains(tvShowXml.FullName)) { doneFiles.Add(tvShowXml.FullName); theActionList.Add(new ActionWdtvMeta(tvShowXml, si)); } return(theActionList); } return(base.ProcessShow(si, forceRefresh)); }
public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh) { if (!TVSettings.Instance.SeriesJpg) { return(null); } ItemList theActionList = new ItemList(); FileInfo fi = FileHelper.FileInFolder(folder, DEFAULT_FILE_NAME); if (forceRefresh || (!doneJpg.Contains(fi.FullName) && !fi.Exists)) { string bannerPath = si.TheSeries().GetSeasonBannerPath(snum); if (!string.IsNullOrEmpty(bannerPath)) { theActionList.Add(new ActionDownloadImage(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages)); } doneJpg.Add(fi.FullName); } return(theActionList); }
public override ItemList ProcessSeason(ShowItem si, string folder, int snum, bool forceRefresh) { if (TVSettings.Instance.SeriesJpg) { ItemList TheActionList = new ItemList(); FileInfo fi = FileHelper.FileInFolder(folder, defaultFileName); if (forceRefresh || (!doneJPG.Contains(fi.FullName) && !fi.Exists)) { string bannerPath = si.TheSeries().GetSeasonBannerPath(snum); if (!string.IsNullOrEmpty(bannerPath)) { TheActionList.Add(new ActionDownload(si, null, fi, bannerPath, TVSettings.Instance.ShrinkLargeMede8erImages)); } doneJPG.Add(fi.FullName); } return(TheActionList); } return(base.ProcessSeason(si, folder, snum, forceRefresh)); }