fix building playouts in timezones with positive offsets (#368)
This commit is contained in:
@@ -16,6 +16,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
- Use fake image extension (`.jpg`) for artwork in M3U and XMLTV since Kodi detects MIME type from URL
|
||||
- Enable HEAD requests for IPTV image paths since Kodi requires those
|
||||
- Properly display watermark when no other video filters (like scaling or padding) are required
|
||||
- Fix building some playouts in timezones with positive offsets (like UTC+2)
|
||||
|
||||
## [0.0.56-alpha] - 2021-09-10
|
||||
### Added
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace ErsatzTV.Application.Emby.Commands
|
||||
|
||||
private async Task<Unit> Synchronize(RequestParameters parameters)
|
||||
{
|
||||
var lastScan = new DateTimeOffset(parameters.Library.LastScan ?? DateTime.MinValue, TimeSpan.Zero);
|
||||
var lastScan = new DateTimeOffset(parameters.Library.LastScan ?? SystemTime.MinValueUtc, TimeSpan.Zero);
|
||||
DateTimeOffset nextScan = lastScan + TimeSpan.FromHours(parameters.LibraryRefreshInterval);
|
||||
if (parameters.ForceScan || nextScan < DateTimeOffset.Now)
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ namespace ErsatzTV.Application.Jellyfin.Commands
|
||||
|
||||
private async Task<Unit> Synchronize(RequestParameters parameters)
|
||||
{
|
||||
var lastScan = new DateTimeOffset(parameters.Library.LastScan ?? DateTime.MinValue, TimeSpan.Zero);
|
||||
var lastScan = new DateTimeOffset(parameters.Library.LastScan ?? SystemTime.MinValueUtc, TimeSpan.Zero);
|
||||
DateTimeOffset nextScan = lastScan + TimeSpan.FromHours(parameters.LibraryRefreshInterval);
|
||||
if (parameters.ForceScan || nextScan < DateTimeOffset.Now)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using ErsatzTV.Core;
|
||||
using ErsatzTV.Core.Domain;
|
||||
using ErsatzTV.Core.Emby;
|
||||
using ErsatzTV.Core.Jellyfin;
|
||||
@@ -43,7 +44,7 @@ namespace ErsatzTV.Application.MediaCards
|
||||
bool isSearchResult) =>
|
||||
new(
|
||||
episodeMetadata.EpisodeId,
|
||||
episodeMetadata.ReleaseDate ?? DateTime.MinValue,
|
||||
episodeMetadata.ReleaseDate ?? SystemTime.MinValueUtc,
|
||||
episodeMetadata.Episode.Season.Show.ShowMetadata.HeadOrNone().Match(
|
||||
m => m.Title ?? string.Empty,
|
||||
() => string.Empty),
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace ErsatzTV.Application.MediaSources.Commands
|
||||
decimal progressMin = (decimal) i / localLibrary.Paths.Count;
|
||||
decimal progressMax = (decimal) (i + 1) / localLibrary.Paths.Count;
|
||||
|
||||
var lastScan = new DateTimeOffset(libraryPath.LastScan ?? DateTime.MinValue, TimeSpan.Zero);
|
||||
var lastScan = new DateTimeOffset(libraryPath.LastScan ?? SystemTime.MinValueUtc, TimeSpan.Zero);
|
||||
DateTimeOffset nextScan = lastScan + TimeSpan.FromHours(libraryRefreshInterval);
|
||||
if (forceScan || nextScan < DateTimeOffset.Now)
|
||||
{
|
||||
|
||||
@@ -65,7 +65,7 @@ namespace ErsatzTV.Application.Plex.Commands
|
||||
|
||||
private async Task<Unit> Synchronize(RequestParameters parameters)
|
||||
{
|
||||
var lastScan = new DateTimeOffset(parameters.Library.LastScan ?? DateTime.MinValue, TimeSpan.Zero);
|
||||
var lastScan = new DateTimeOffset(parameters.Library.LastScan ?? SystemTime.MinValueUtc, TimeSpan.Zero);
|
||||
DateTimeOffset nextScan = lastScan + TimeSpan.FromHours(parameters.LibraryRefreshInterval);
|
||||
if (parameters.ForceScan || nextScan < DateTimeOffset.Now)
|
||||
{
|
||||
|
||||
@@ -4,6 +4,6 @@ namespace ErsatzTV.Core.Tests.Fakes
|
||||
{
|
||||
public record FakeFileEntry(string Path)
|
||||
{
|
||||
public DateTime LastWriteTime { get; set; } = DateTime.MinValue;
|
||||
public DateTime LastWriteTime { get; set; } = SystemTime.MinValueUtc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace ErsatzTV.Core.Tests.Fakes
|
||||
public DateTime GetLastWriteTime(string path) =>
|
||||
Optional(_files.SingleOrDefault(f => f.Path == path))
|
||||
.Map(f => f.LastWriteTime)
|
||||
.IfNone(DateTime.MinValue);
|
||||
.IfNone(SystemTime.MinValueUtc);
|
||||
|
||||
public bool IsLibraryPathAccessible(LibraryPath libraryPath) =>
|
||||
_files.Any(f => f.Path.StartsWith(libraryPath.Path + Path.DirectorySeparatorChar));
|
||||
|
||||
@@ -22,7 +22,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
}
|
||||
|
||||
public DateTime GetLastWriteTime(string path) =>
|
||||
Try(File.GetLastWriteTimeUtc(path)).IfFail(() => DateTime.MinValue);
|
||||
Try(File.GetLastWriteTimeUtc(path)).IfFail(() => SystemTime.MinValueUtc);
|
||||
|
||||
public bool IsLibraryPathAccessible(LibraryPath libraryPath) =>
|
||||
Directory.Exists(libraryPath.Path);
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
existing.Tagline = metadata.Tagline;
|
||||
existing.Title = metadata.Title;
|
||||
|
||||
if (existing.DateAdded == DateTime.MinValue)
|
||||
if (existing.DateAdded == SystemTime.MinValueUtc)
|
||||
{
|
||||
existing.DateAdded = metadata.DateAdded;
|
||||
}
|
||||
@@ -318,7 +318,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
existing.Tagline = metadata.Tagline;
|
||||
existing.Title = metadata.Title;
|
||||
|
||||
if (existing.DateAdded == DateTime.MinValue)
|
||||
if (existing.DateAdded == SystemTime.MinValueUtc)
|
||||
{
|
||||
existing.DateAdded = metadata.DateAdded;
|
||||
}
|
||||
@@ -423,7 +423,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
existing.Tagline = metadata.Tagline;
|
||||
existing.Title = metadata.Title;
|
||||
|
||||
if (existing.DateAdded == DateTime.MinValue)
|
||||
if (existing.DateAdded == SystemTime.MinValueUtc)
|
||||
{
|
||||
existing.DateAdded = metadata.DateAdded;
|
||||
}
|
||||
@@ -486,7 +486,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
existing.Disambiguation = metadata.Disambiguation;
|
||||
existing.Biography = metadata.Biography;
|
||||
|
||||
if (existing.DateAdded == DateTime.MinValue)
|
||||
if (existing.DateAdded == SystemTime.MinValueUtc)
|
||||
{
|
||||
existing.DateAdded = metadata.DateAdded;
|
||||
}
|
||||
@@ -581,7 +581,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
existing.Plot = metadata.Plot;
|
||||
existing.Album = metadata.Album;
|
||||
|
||||
if (existing.DateAdded == DateTime.MinValue)
|
||||
if (existing.DateAdded == SystemTime.MinValueUtc)
|
||||
{
|
||||
existing.DateAdded = metadata.DateAdded;
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ namespace ErsatzTV.Core.Metadata
|
||||
async () =>
|
||||
{
|
||||
bool shouldUpdate = Optional(episode.EpisodeMetadata).Flatten().HeadOrNone().Match(
|
||||
m => m.DateUpdated == DateTime.MinValue,
|
||||
m => m.DateUpdated == SystemTime.MinValueUtc,
|
||||
true);
|
||||
|
||||
if (shouldUpdate)
|
||||
|
||||
@@ -374,9 +374,9 @@ namespace ErsatzTV.Core.Scheduling
|
||||
}
|
||||
|
||||
bool willNotFinishInTime =
|
||||
currentTime <= durationFinish.IfNone(DateTime.MinValue) &&
|
||||
currentTime <= durationFinish.IfNone(SystemTime.MinValueUtc) &&
|
||||
currentTime + peekVersion.Duration >
|
||||
durationFinish.IfNone(DateTime.MinValue);
|
||||
durationFinish.IfNone(SystemTime.MinValueUtc);
|
||||
if (willNotFinishInTime)
|
||||
{
|
||||
_logger.LogDebug(
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace ErsatzTV.Core
|
||||
{
|
||||
public static class SystemTime
|
||||
{
|
||||
public static DateTime MinValueUtc = new(0, DateTimeKind.Utc);
|
||||
}
|
||||
}
|
||||
@@ -703,7 +703,7 @@ namespace ErsatzTV.Infrastructure.Data.Repositories
|
||||
new()
|
||||
{
|
||||
DateAdded = DateTime.UtcNow,
|
||||
DateUpdated = DateTime.MinValue,
|
||||
DateUpdated = SystemTime.MinValueUtc,
|
||||
MetadataKind = MetadataKind.Fallback,
|
||||
Actors = new List<Actor>(),
|
||||
Guids = new List<MetadataGuid>(),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using ErsatzTV.Core;
|
||||
using Lucene.Net.Analysis;
|
||||
using Lucene.Net.QueryParsers.Classic;
|
||||
using Lucene.Net.Search;
|
||||
@@ -53,7 +54,7 @@ namespace ErsatzTV.Infrastructure.Search
|
||||
|
||||
internal static bool ParseStart(string text, out DateTime start)
|
||||
{
|
||||
start = DateTime.MinValue;
|
||||
start = SystemTime.MinValueUtc;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user