public override ItemList ProcessEpisode(ProcessedEpisode dbep, FileInfo filo, bool forceRefresh) { if (!TVSettings.Instance.CorrectFileDates || !dbep.FirstAired.HasValue) { return(null); } DateTime newUpdateTime = Helpers.GetMinWindowsTime(dbep.FirstAired.Value); try { if ((filo.LastWriteTimeUtc != newUpdateTime) && (!doneFilesAndFolders.Contains(filo.FullName))) { doneFilesAndFolders.Add(filo.FullName); return(new ItemList() { new ActionDateTouch(filo, dbep, newUpdateTime) }); } } catch (Exception) { doneFilesAndFolders.Add(filo.FullName); return(new ItemList() { new ActionDateTouch(filo, dbep, newUpdateTime) }); } return(null); }
public override ItemList ProcessSeason([NotNull] ShowItem si, string folder, int snum, bool forceRefresh) { DateTime?updateTime = si.GetSeason(snum)?.LastAiredDate(); if (!TVSettings.Instance.CorrectFileDates || !updateTime.HasValue) { 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 ActionDateTouch(di, si, newUpdateTime) }); } } catch (Exception) { doneFilesAndFolders.Add(di.FullName); return(new ItemList() { new ActionDateTouch(di, si, newUpdateTime) }); } return(null); }
public override ItemList ProcessShow([NotNull] ShowItem si, bool forceRefresh) { DateTime?updateTime = si.TheSeries()?.LastAiredDate; if (!TVSettings.Instance.CorrectFileDates || !updateTime.HasValue) { return(null); } DateTime newUpdateTime = Helpers.GetMinWindowsTime(updateTime.Value); DirectoryInfo di = new DirectoryInfo(si.AutoAddFolderBase); try { if (di.LastWriteTimeUtc != newUpdateTime && !doneFilesAndFolders.Contains(di.FullName)) { doneFilesAndFolders.Add(di.FullName); return(new ItemList { new ActionDateTouch(di, si, newUpdateTime) }); } } catch (Exception) { doneFilesAndFolders.Add(di.FullName); return(new ItemList { new ActionDateTouch(di, si, newUpdateTime) }); } return(null); }
public override ItemList?ProcessMovie(MovieConfiguration movie, FileInfo file, bool forceRefresh) { DateTime?updateTime = movie.CachedMovie?.FirstAired; if (!TVSettings.Instance.CorrectFileDates || !updateTime.HasValue) { return(base.ProcessMovie(movie, file, forceRefresh)); } DateTime newUpdateTime = Helpers.GetMinWindowsTime(updateTime.Value); DirectoryInfo di = file.Directory; ItemList returnItems = new ItemList(); try { if (di.LastWriteTimeUtc != newUpdateTime && !doneFilesAndFolders.Contains(di.FullName)) { doneFilesAndFolders.Add(di.FullName); returnItems.Add(new ActionDateTouchMedia(di, movie, newUpdateTime)); } } catch (Exception) { doneFilesAndFolders.Add(di.FullName); returnItems.Add(new ActionDateTouchMedia(di, movie, newUpdateTime)); } try { if (file.LastWriteTimeUtc != newUpdateTime && !doneFilesAndFolders.Contains(file.FullName)) { doneFilesAndFolders.Add(file.FullName); returnItems.Add(new ActionDateTouchMovie(file, movie, newUpdateTime)); } } catch (Exception) { doneFilesAndFolders.Add(file.FullName); returnItems.Add(new ActionDateTouchMovie(file, movie, newUpdateTime)); } return(returnItems); }
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); }