private static IEnumerable <Item> CopyFutureDatedFile(FileInfo fi, [NotNull] ProcessedEpisode pep) { ShowItem si = pep.Show; int seasF = pep.AppropriateSeasonNumber; int epF = pep.AppropriateEpNum; //This episode may be a future dated one - process it now if the settings request that we do and it wont be picked up in a full scan if (!TVSettings.Instance.CopyFutureDatedEpsFromSearchFolders || si.ForceCheckFuture || !si.DoMissingCheck || !TVSettings.Instance.MissingCheck || TVSettings.Instance.PreventMove) { return(new List <Item>()); } if (!pep.IsInFuture()) { return(new List <Item>()); } Dictionary <int, List <string> > foldersLocations = si.AllProposedFolderLocations(); if (!foldersLocations.ContainsKey(seasF)) { LOGGER.Info( $"Identified that {fi.FullName} matches S{seasF}E{epF} of show {si.ShowName}, but can't tell where to copy it. Not copying across."); return(new List <Item>()); } LOGGER.Info( $"Identified that {fi.FullName} matches S{seasF}E{epF} of show {si.ShowName}, that it's not already present and airs in the future. Copying across."); List <string> folders = si.AllProposedFolderLocations()[seasF]; List <Item> returnActions = new List <Item>(); foreach (string folder in folders) { if (!Directory.Exists(folder)) { LOGGER.Warn($"Want to copy {fi.FullName} to {folder}, but it doesn't exist yet"); continue; } string filename = TVSettings.Instance.FilenameFriendly(TVSettings.Instance.NamingStyle.NameFor(pep, fi.Extension, folder.Length)); FileInfo targetFile = new FileInfo(folder + Path.DirectorySeparatorChar + filename); if (fi.FullName == targetFile.FullName) { continue; } returnActions.Add(new ActionCopyMoveRename(fi, targetFile, pep)); // if we're copying/moving a file across, we might also want to make a thumbnail or NFO for it returnActions.AddRange(new DownloadIdentifiersController().ProcessEpisode(pep, targetFile)); } return(returnActions); }
protected override void Check([NotNull] ShowItem si, DirFilesCache dfc, TVDoc.ScanSettings settings) { if (!si.DoMissingCheck && !si.DoRename) { return; // skip } Dictionary <int, List <string> > flocs = si.AllProposedFolderLocations(); List <string> ignoredLocations = new List <string>(); foreach (int snum in si.GetSeasonKeys()) { // show MissingFolderAction for any folders that are missing // throw Exception if user cancels if (si.IgnoreSeasons.Contains(snum)) { continue; // ignore this season } if (snum == 0 && si.CountSpecials) { continue; // no specials season, they're merged into the seasons themselves } if (snum == 0 && TVSettings.Instance.IgnoreAllSpecials) { continue; } List <string> folders = new List <string>(); if (flocs.ContainsKey(snum)) { folders = flocs[snum]; } if (si.SeasonEpisodes[snum].All(episode => !MightWeProcess(episode, folders))) { //All episodes in this season are ignored continue; } if (folders.Count == 0 && si.AutoAddNewSeasons()) { // no folders defined for this season, and autoadd didn't find any, so suggest the autoadd folder name instead folders.Add(si.AutoFolderNameForSeason(snum)); } if (folders.Count == 0 && !si.AutoAddNewSeasons()) { // no folders defined for this season, and autoadd didn't find any, so suggest the autoadd folder name instead folders.Add(string.Empty); } CreateSeasonFolders(si, snum, folders, ignoredLocations); } // for each snum }