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
        }
Exemplo n.º 2
0
        private void CheckSeason([NotNull] ShowItem si, DirFilesCache dfc, TVDoc.ScanSettings settings, int snum, [NotNull] IReadOnlyCollection <string> folders, bool timeForBannerUpdate)
        {
            bool folderNotDefined = (folders.Count == 0);

            if (folderNotDefined && (TVSettings.Instance.MissingCheck && !si.AutoAddNewSeasons()))
            {
                return;
            }

            // base folder:
            if (!string.IsNullOrEmpty(si.AutoAddFolderBase) && (si.AutoAddType != ShowItem.AutomaticFolderType.none))
            {
                // main image for the folder itself
                Doc.TheActionList.Add(downloadIdentifiers.ProcessShow(si));
            }

            foreach (string folder in folders)
            {
                CheckSeasonFolder(si, dfc, settings, snum, timeForBannerUpdate, folder);
            } // for each folder for this season of this show
        }
Exemplo n.º 3
0
        private static bool RejectFolderIfIncludedInShow(bool fullLogging, [NotNull] ShowItem 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 {0} as it's already part of {1}.", theFolder, si.ShowName);
                }

                return(true);
            }

            if (si.UsesManualFolders())
            {
                Dictionary <int, List <string> > afl = si.AllExistngFolderLocations();
                foreach (KeyValuePair <int, List <string> > kvp in afl)
                {
                    foreach (string folder in kvp.Value)
                    {
                        if (!string.Equals(theFolder, folder, StringComparison.CurrentCultureIgnoreCase))
                        {
                            continue;
                        }

                        if (fullLogging)
                        {
                            Logger.Info("Rejecting {0} as it's already part of {1}:{2}.", theFolder, si.ShowName,
                                        folder);
                        }

                        return(true);
                    }
                }
            }

            return(false);
        }