Ejemplo n.º 1
0
        public override ItemList?ProcessSeason(ShowConfiguration si, string folder, int snum, bool forceRefresh)
        {
            ProcessedSeason processedSeason = si.GetSeason(snum) ?? throw new ArgumentException($"ProcessSeason called for {si.ShowName} invalid season ({snum}), show has ({si.AppropriateSeasons().Keys.Select(i => i.ToString() ).ToCsv()})");
            DateTime?       updateTime      = processedSeason.LastAiredDate();

            if (!TVSettings.Instance.CorrectFileDates || !updateTime.HasValue)
            {
                return(null);
            }

            if (si.AutoAddType == ShowConfiguration.AutomaticFolderType.baseOnly && folder.Equals(si.AutoAddFolderBase))
            {
                //We do not need to look at the season folder - there is no such thing as it'll be covered by the show folder
                return(null);
            }

            DateTime newUpdateTime = Helpers.GetMinWindowsTime(updateTime.Value);

            DirectoryInfo di = new DirectoryInfo(folder);

            try
            {
                if (di.LastWriteTimeUtc != newUpdateTime && !doneFilesAndFolders.Contains(di.FullName))
                {
                    doneFilesAndFolders.Add(di.FullName);
                    return(new ItemList {
                        new ActionDateTouchSeason(di, processedSeason, newUpdateTime)
                    });
                }
            }
            catch (Exception)
            {
                doneFilesAndFolders.Add(di.FullName);
                return(new ItemList {
                    new ActionDateTouchSeason(di, processedSeason, newUpdateTime)
                });
            }

            return(null);
        }