private void GenerateOpenMenu([NotNull] ProcessedSeason seas, ICollection <string> added) { Dictionary <int, SafeList <string> > afl = show.AllExistngFolderLocations(); if (!afl.ContainsKey(seas.SeasonNumber)) { return; } bool first = true; foreach (string folder in afl[seas.SeasonNumber].OrderBy(s => s)) { if (!string.IsNullOrEmpty(folder) && Directory.Exists(folder) && !added.Contains(folder)) { added.Add(folder); // don't show the same folder more than once if (first) { GenerateSeparator(gridSummary.showRightClickMenu); first = false; } AddRcMenuItem(gridSummary.showRightClickMenu, "Open: " + folder, (sender, args) => { Helpers.OpenFolder(folder); }); } } }
protected override void Check(ShowConfiguration si, DirFilesCache dfc, TVDoc.ScanSettings settings) { Dictionary <int, SafeList <string> > allFolders = si.AllExistngFolderLocations(); if (allFolders.Count == 0) // no folders defined for this show { return; // so, nothing to do. } //This is the code that will iterate over the DownloadIdentifiers and ask each to ensure that //it has all the required files for that show if (!string.IsNullOrEmpty(si.AutoAddFolderBase) && allFolders.Any()) { Doc.TheActionList.Add(downloadIdentifiers.ProcessShow(si)); } //MS_TODO Put the banner refresh period into the settings file, we'll default to 3 months DateTime cutOff = DateTime.Now.AddMonths(-3); DateTime lastUpdate = si.BannersLastUpdatedOnDisk ?? DateTime.Now.AddMonths(-4); bool timeForBannerUpdate = cutOff.CompareTo(lastUpdate) == 1; if (TVSettings.Instance.NeedToDownloadBannerFile() && timeForBannerUpdate) { Doc.TheActionList.Add( downloadIdentifiers.ForceUpdateShow(DownloadIdentifier.DownloadType.downloadImage, si)); si.BannersLastUpdatedOnDisk = DateTime.Now; Doc.SetDirty(); } // process each folder for each season... foreach (int snum in si.ActiveSeasons.Keys()) { if (settings.Token.IsCancellationRequested) { return; } if (!allFolders.ContainsKey(snum)) { continue; } // all the folders for this particular season SafeList <string> folders = allFolders[snum]; CheckSeason(si, dfc, settings, snum, folders, timeForBannerUpdate); } // for each season of this show }
private static bool RejectFolderIfIncludedInShow(bool fullLogging, [NotNull] ShowConfiguration si, string theFolder) { if (si.AutoAddNewSeasons() && !string.IsNullOrEmpty(si.AutoAddFolderBase) && theFolder.IsSubfolderOf(si.AutoAddFolderBase)) { // we're looking at a folder that is a subfolder of an existing show if (fullLogging) { Logger.Info($"Rejecting {theFolder} as it's already part of {si.ShowName}."); } return(true); } if (si.UsesManualFolders()) { Dictionary <int, SafeList <string> > afl = si.AllExistngFolderLocations(); foreach (KeyValuePair <int, SafeList <string> > kvp in afl) { foreach (string folder in kvp.Value) { if (!string.Equals(theFolder, folder, StringComparison.CurrentCultureIgnoreCase)) { continue; } if (fullLogging) { Logger.Info($"Rejecting {theFolder} as it's already part of {si.ShowName}:{folder}."); } return(true); } } } return(false); }
protected override void Check(ShowConfiguration si, DirFilesCache dfc, TVDoc.ScanSettings settings) { if (settings.Token.IsCancellationRequested) { throw new TVRenameOperationInterruptedException(); } if (!Active()) { return; } Dictionary <int, SafeList <string> > allFolders = si.AllExistngFolderLocations(); if (allFolders.Count == 0) // no folders defined for this show { return; // so, nothing to do. } // process each folder for each season... foreach (int snum in si.GetSeasonKeys()) { if (settings.Token.IsCancellationRequested) { throw new TVRenameOperationInterruptedException(); } if (si.IgnoreSeasons.Contains(snum) || !allFolders.ContainsKey(snum)) { continue; } // all the folders for this particular season MergeShowEpisodes(si, dfc, settings.Token, snum, allFolders[snum]); } // for each season of this show }