diff --git a/TVRename/Model/Episode.cs b/TVRename/Model/Episode.cs index 40260edc..ab8fb8a8 100644 --- a/TVRename/Model/Episode.cs +++ b/TVRename/Model/Episode.cs @@ -92,15 +92,19 @@ protected Episode(Episode o) public LocalDateTime? GetAirDateDt() { - if (FirstAired is null || internalSeries is null) + DateTime? fa = FirstAired; + + if (fa is null) { return null; } + DateTime? airs = internalSeries?.AirsTime ?? AirStamp; - DateTime fa = (DateTime)FirstAired; - DateTime? airs = internalSeries.AirsTime; + int defaultHour = (internalSeries?.Network).IsStreamingService() + ? 0 + : 20; - return new LocalDateTime(fa.Year, fa.Month, fa.Day, airs?.Hour ?? 20, airs?.Minute ?? 0); + return new LocalDateTime(fa.Value.Year, fa.Value.Month, fa.Value.Day, airs?.Hour ?? defaultHour, airs?.Minute ?? 0); } public DateTime? GetAirDateDt(DateTimeZone tz) diff --git a/TVRename/ScanActivity/CleanDownloadDirectory.cs b/TVRename/ScanActivity/CleanDownloadDirectory.cs index 7492673d..3dde5f1b 100644 --- a/TVRename/ScanActivity/CleanDownloadDirectory.cs +++ b/TVRename/ScanActivity/CleanDownloadDirectory.cs @@ -159,8 +159,8 @@ private static Action SetupDirectoryRemoval(DirectoryInfo di, { ShowConfiguration si = matchingShows[0]; //Choose the first cachedSeries FinderHelper.FindSeasEp(di, out int seasF, out int epF, si, out TVSettings.FilenameProcessorRE? _); - CachedSeriesInfo? s = si.CachedShow; - if (s is null) + + if (si.CachedShow is null) { throw new ArgumentNullException(nameof(matchingShows), "s is null"); } diff --git a/TVRename/Utility/Helper/JSONHelper.cs b/TVRename/Utility/Helper/JSONHelper.cs index 9e1d6dd9..61efb84e 100644 --- a/TVRename/Utility/Helper/JSONHelper.cs +++ b/TVRename/Utility/Helper/JSONHelper.cs @@ -38,7 +38,7 @@ public static class JsonHelper { Logger.Error($"Failed to parse time: {theTime}"); } - return DateTime.Parse("20:00"); + return null; } public static bool ContainsTyped(this JArray arr, T? item) diff --git a/TVRename/Utility/Helper/TimeZoneHelper.cs b/TVRename/Utility/Helper/TimeZoneHelper.cs index 284ac7f6..348ca39d 100644 --- a/TVRename/Utility/Helper/TimeZoneHelper.cs +++ b/TVRename/Utility/Helper/TimeZoneHelper.cs @@ -22,6 +22,18 @@ public static class TimeZoneHelper public static string DefaultTimeZone() => "America/New_York"; + public static bool IsStreamingService(this string? network) + { + if (string.IsNullOrWhiteSpace(network)) + { + return false; + } + + string[] streamers = { "Netflix","Apple TV+","Disney+","Amazon Prime Video","Paramount+" }; + + return streamers.Contains(network); + } + public static string TimeZoneForNetwork(string? network, string defaultTimeZone) { string[] uktv = { "Sky Atlantic (UK)", "BBC One", "Sky1", "BBC Two", "ITV", "Nick Jr.", "BBC Three", "Channel 4", "CBeebies", "Sky Box Office", "Watch", "ITV2", "National Geographic (UK)", "V", "ITV Encore", "ITV1", "BBC", "E4", "Channel 5 (UK)", "BBC Four", "ITVBe" };