Example #1
0
        protected override void DoCheck(SetProgressDelegate prog, ICollection <ShowItem> showList, TVDoc.ScanSettings settings)
        {
            // have a look around for any missing episodes
            List <Finder> appropriateFinders      = finders.Where(f => f.DisplayType() == CurrentType() && f.Active()).ToList();
            int           currentMatchingFinderId = 0;
            int           totalMatchingFinders    = appropriateFinders.Count;

            foreach (Finder f in appropriateFinders)
            {
                if (settings.Token.IsCancellationRequested)
                {
                    return;
                }

                if (!MDoc.TheActionList.MissingItems().Any())
                {
                    continue;
                }

                f.ActionList = MDoc.TheActionList;

                currentMatchingFinderId++;
                int startPos = 100 * (currentMatchingFinderId - 1) / totalMatchingFinders;
                int endPos   = 100 * currentMatchingFinderId / totalMatchingFinders;
                f.Check(prog, startPos, endPos, showList, settings);

                MDoc.RemoveIgnored();
            }
        }
Example #2
0
        protected override void DoCheck(SetProgressDelegate prog, ICollection <ShowItem> showList, TVDoc.ScanSettings settings)
        {
            MDoc.TheActionList = new ItemList();

            if (TVSettings.Instance.RenameCheck)
            {
                MDoc.Stats().RenameChecksDone++;
            }

            if (TVSettings.Instance.MissingCheck)
            {
                MDoc.Stats().MissingChecksDone++;
            }

            if (settings.Type == TVSettings.ScanType.Full)
            {
                // only do episode count if we're doing all shows and seasons
                MDoc.CurrentStats.NsNumberOfEpisodes = 0;
                showList = MDoc.Library.Values;
            }

            DirFilesCache dfc = new DirFilesCache();

            int c = 0;

            UpdateStatus(c, showList.Count, "Checking shows");
            foreach (ShowItem si in showList.OrderBy(item => item.ShowName))
            {
                UpdateStatus(c++, showList.Count, si.ShowName);
                if (settings.Token.IsCancellationRequested)
                {
                    return;
                }

                LOGGER.Info("Rename and missing check: " + si.ShowName);
                try
                {
                    new CheckAllFoldersExist(MDoc).CheckIfActive(si, dfc, settings);
                    new MergeLibraryEpisodes(MDoc).CheckIfActive(si, dfc, settings);
                    new RenameAndMissingCheck(MDoc).CheckIfActive(si, dfc, settings);
                }
                catch (TVRenameOperationInterruptedException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    LOGGER.Error(e, $"Failed to scan {si.ShowName}. Please double check settings for this show: {si.TvdbCode}: {si.AutoAddFolderBase}");
                }
            } // for each show

            MDoc.RemoveIgnored();
        }