From c56e2526c4ab4cbe54317a14a9a22c323164eea5 Mon Sep 17 00:00:00 2001 From: Jason Dove Date: Mon, 6 Mar 2023 08:28:35 -0600 Subject: [PATCH] fix media server scanning (#1196) * fix media server scans * update dependencies --- CHANGELOG.md | 1 + .../Emby/Commands/CallEmbyLibraryScannerHandler.cs | 4 +++- ErsatzTV.Application/ErsatzTV.Application.csproj | 2 +- .../Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs | 4 +++- .../MediaSources/Commands/CallLocalLibraryScannerHandler.cs | 5 +++-- .../Plex/Commands/CallPlexLibraryScannerHandler.cs | 4 +++- ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj | 4 ++-- ErsatzTV.Core/ErsatzTV.Core.csproj | 4 ++-- ErsatzTV.FFmpeg.Tests/ErsatzTV.FFmpeg.Tests.csproj | 4 ++-- .../ErsatzTV.Infrastructure.Tests.csproj | 6 +++--- ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj | 4 ++-- ErsatzTV.Scanner.Tests/ErsatzTV.Scanner.Tests.csproj | 6 +++--- ErsatzTV.Scanner/ErsatzTV.Scanner.csproj | 2 +- ErsatzTV/ErsatzTV.csproj | 2 +- 14 files changed, 30 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dcd586672..2cd5e849a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Fix scaling anamorphic content from non-local libraries - Fix direct streaming content from Jellyfin that has external subtitles - Note that these subtitles are not currently supported in ETV, but they did cause a playback issue +- Fix Jellyfin, Emby and Plex library scans that wouldn't work in certain timezones ## [0.7.5-beta] - 2023-03-05 ### Added diff --git a/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs b/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs index fe57edd69..d4eb0b8ab 100644 --- a/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs @@ -77,9 +77,11 @@ public class CallEmbyLibraryScannerHandler : CallLibraryScannerHandler l.Id, l => l.Id == request.EmbyLibraryId) .Match(l => l.LastScan ?? SystemTime.MinValueUtc, () => SystemTime.MaxValueUtc); + + return new DateTimeOffset(minDateTime, TimeSpan.Zero); } protected override bool ScanIsRequired( diff --git a/ErsatzTV.Application/ErsatzTV.Application.csproj b/ErsatzTV.Application/ErsatzTV.Application.csproj index 377b9c18c..3a8644934 100644 --- a/ErsatzTV.Application/ErsatzTV.Application.csproj +++ b/ErsatzTV.Application/ErsatzTV.Application.csproj @@ -10,7 +10,7 @@ - + all diff --git a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs index 647f1a81d..3e55e098e 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs @@ -77,9 +77,11 @@ public class CallJellyfinLibraryScannerHandler : CallLibraryScannerHandler l.Id, l => l.Id == request.JellyfinLibraryId) .Match(l => l.LastScan ?? SystemTime.MinValueUtc, () => SystemTime.MaxValueUtc); + + return new DateTimeOffset(minDateTime, TimeSpan.Zero); } protected override bool ScanIsRequired( diff --git a/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs b/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs index 9e4261b34..fe122b0d4 100644 --- a/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs +++ b/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs @@ -1,6 +1,7 @@ using System.Threading.Channels; using ErsatzTV.Application.Libraries; using ErsatzTV.Core; +using ErsatzTV.Core.Domain; using ErsatzTV.Core.Errors; using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.FFmpeg.Runtime; @@ -67,11 +68,11 @@ public class CallLocalLibraryScannerHandler : CallLibraryScannerHandler GetLastScan(TvContext dbContext, IScanLocalLibrary request) { - var libraryPaths = await dbContext.LibraryPaths + List libraryPaths = await dbContext.LibraryPaths .Filter(lp => lp.LibraryId == request.LibraryId) .ToListAsync(); - var minDateTime = libraryPaths.Any() + DateTime minDateTime = libraryPaths.Any() ? libraryPaths.Min(lp => lp.LastScan ?? SystemTime.MinValueUtc) : SystemTime.MaxValueUtc; diff --git a/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs b/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs index eefb9e680..fb1ec4f1e 100644 --- a/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs @@ -77,9 +77,11 @@ public class CallPlexLibraryScannerHandler : CallLibraryScannerHandler l.Id, l => l.Id == request.PlexLibraryId) .Match(l => l.LastScan ?? SystemTime.MinValueUtc, () => SystemTime.MaxValueUtc); + + return new DateTimeOffset(minDateTime, TimeSpan.Zero); } protected override bool ScanIsRequired( diff --git a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj index e487d5b1f..e7fea778f 100644 --- a/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj +++ b/ErsatzTV.Core.Tests/ErsatzTV.Core.Tests.csproj @@ -16,14 +16,14 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/ErsatzTV.Core/ErsatzTV.Core.csproj b/ErsatzTV.Core/ErsatzTV.Core.csproj index 492b67b2f..3aebacdfe 100644 --- a/ErsatzTV.Core/ErsatzTV.Core.csproj +++ b/ErsatzTV.Core/ErsatzTV.Core.csproj @@ -12,12 +12,12 @@ - + - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/ErsatzTV.FFmpeg.Tests/ErsatzTV.FFmpeg.Tests.csproj b/ErsatzTV.FFmpeg.Tests/ErsatzTV.FFmpeg.Tests.csproj index 9e28f2209..014531fae 100644 --- a/ErsatzTV.FFmpeg.Tests/ErsatzTV.FFmpeg.Tests.csproj +++ b/ErsatzTV.FFmpeg.Tests/ErsatzTV.FFmpeg.Tests.csproj @@ -10,10 +10,10 @@ - + - + diff --git a/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj b/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj index 33a47149e..c24f15432 100644 --- a/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj +++ b/ErsatzTV.Infrastructure.Tests/ErsatzTV.Infrastructure.Tests.csproj @@ -10,11 +10,11 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj index d20709f50..7345f07d3 100644 --- a/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj +++ b/ErsatzTV.Infrastructure/ErsatzTV.Infrastructure.csproj @@ -11,7 +11,7 @@ - + @@ -28,7 +28,7 @@ - + diff --git a/ErsatzTV.Scanner.Tests/ErsatzTV.Scanner.Tests.csproj b/ErsatzTV.Scanner.Tests/ErsatzTV.Scanner.Tests.csproj index f54a1ed65..5a374b713 100644 --- a/ErsatzTV.Scanner.Tests/ErsatzTV.Scanner.Tests.csproj +++ b/ErsatzTV.Scanner.Tests/ErsatzTV.Scanner.Tests.csproj @@ -11,11 +11,11 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj b/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj index c398a1827..1cf185faf 100644 --- a/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj +++ b/ErsatzTV.Scanner/ErsatzTV.Scanner.csproj @@ -18,7 +18,7 @@ - + diff --git a/ErsatzTV/ErsatzTV.csproj b/ErsatzTV/ErsatzTV.csproj index f361d5beb..9c0cdf422 100644 --- a/ErsatzTV/ErsatzTV.csproj +++ b/ErsatzTV/ErsatzTV.csproj @@ -58,7 +58,7 @@ - +