Simplified Stale Episodes logic

This commit is contained in:
2026-01-19 08:10:54 -07:00
parent b2da7beb00
commit f7c463aba4
2 changed files with 4 additions and 14 deletions

View File

@@ -149,13 +149,11 @@ public class LoggingHelper
} }
} }
public void PrintDebugNoUserDataAndOutsideCutoffEpisodeInfo(IReadOnlyCollection<BaseItem> episodes) public void PrintDebugEpisodeCreationInfo(IReadOnlyCollection<BaseItem> episodes)
{ {
ArgumentNullException.ThrowIfNull(episodes); ArgumentNullException.ThrowIfNull(episodes);
if(Configuration.DebugMode){ if(Configuration.DebugMode){
_logger.LogInformation("No user data, and creation date is outside of media cutoff, Season is stale.");
_logger.LogInformation("-------------------------------------------------"); _logger.LogInformation("-------------------------------------------------");
_logger.LogInformation("Episode creation dates:"); _logger.LogInformation("Episode creation dates:");
_logger.LogInformation("-------------------------------------------------"); _logger.LogInformation("-------------------------------------------------");

View File

@@ -121,24 +121,16 @@ public sealed class StaleMediaTask : IScheduledTask
Recursive = false Recursive = false
}); });
bool seasonCreatedOutsideCutoff = episodes.All(episode => episode.DateCreated < DateTime.Now.AddDays(-Configuration.StaleMediaCutoff));
_loggingHelper.PrintDebugSeasonInfo(); _loggingHelper.PrintDebugSeasonInfo();
if (seasonCreatedOutsideCutoff)
{
_loggingHelper.PrintDebugSeasonCreatedOutsideCutoff();
}
bool seasonHasUserData = episodes.Any(episode => episode.UserData.Count > 0); bool seasonHasUserData = episodes.Any(episode => episode.UserData.Count > 0);
bool seasonIsStale = (seasonHasUserData && _seriesHelper.IsSeasonUserDataStale(episodes)) || seasonCreatedOutsideCutoff; bool seasonIsStale = seasonHasUserData && _seriesHelper.IsSeasonUserDataStale(episodes);
bool noUserDataAndOutsideCutoff = !seasonHasUserData && seasonCreatedOutsideCutoff;
if (seasonIsStale) if (seasonIsStale)
{ {
if (noUserDataAndOutsideCutoff) if (!seasonHasUserData)
{ {
_loggingHelper.PrintDebugNoUserDataAndOutsideCutoffEpisodeInfo(episodes); _loggingHelper.PrintDebugEpisodeCreationInfo(episodes);
} }
staleEpisodes.AddRange(episodes); staleEpisodes.AddRange(episodes);