diff --git a/CHANGELOG.md b/CHANGELOG.md index ab7ab9a26..448249500 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -89,6 +89,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). - Validation tool in the UI still uses Newtonsoft.Json.Schema (with 1000/hr limit) as the error output is easier to understand - Fix editing scripted and sequential playouts when using MySql - Fix HLS Direct streams remaining open after client disconnect +- Always log scanner exit code when it is non-zero ### Changed - Classic schedules: `Refresh` classic playouts from playout list; do not `Reset` them diff --git a/ErsatzTV.Application/Emby/Commands/CallEmbyCollectionScannerHandler.cs b/ErsatzTV.Application/Emby/Commands/CallEmbyCollectionScannerHandler.cs index 10fda6219..5e45772c7 100644 --- a/ErsatzTV.Application/Emby/Commands/CallEmbyCollectionScannerHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/CallEmbyCollectionScannerHandler.cs @@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Emby; @@ -21,7 +22,12 @@ public class CallEmbyCollectionScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) : base( + dbContextFactory, + configElementRepository, + runtimeInfo, + logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs b/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs index d2c01dbf6..5afd76342 100644 --- a/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs @@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Emby; @@ -22,8 +23,9 @@ public class CallEmbyLibraryScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) - : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Emby/Commands/CallEmbyShowScannerHandler.cs b/ErsatzTV.Application/Emby/Commands/CallEmbyShowScannerHandler.cs index 7c385108d..94626b442 100644 --- a/ErsatzTV.Application/Emby/Commands/CallEmbyShowScannerHandler.cs +++ b/ErsatzTV.Application/Emby/Commands/CallEmbyShowScannerHandler.cs @@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Emby; @@ -19,8 +20,9 @@ public class CallEmbyShowScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) - : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinCollectionScannerHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinCollectionScannerHandler.cs index 6176aaa49..5a03aa1c7 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinCollectionScannerHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinCollectionScannerHandler.cs @@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Jellyfin; @@ -21,7 +22,12 @@ public class CallJellyfinCollectionScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) : base( + dbContextFactory, + configElementRepository, + runtimeInfo, + logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs index 24d640f5b..8f612d3d1 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs @@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Jellyfin; @@ -22,8 +23,9 @@ public class CallJellyfinLibraryScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) - : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinShowScannerHandler.cs b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinShowScannerHandler.cs index d009cabc9..4392fb8bd 100644 --- a/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinShowScannerHandler.cs +++ b/ErsatzTV.Application/Jellyfin/Commands/CallJellyfinShowScannerHandler.cs @@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Jellyfin; @@ -19,8 +20,9 @@ public class CallJellyfinShowScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) - : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs b/ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs index e84a93b0e..1b1ead77d 100644 --- a/ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs +++ b/ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs @@ -11,13 +11,16 @@ using Serilog; using Serilog.Core; using Serilog.Events; using Serilog.Formatting.Compact.Reader; +using Microsoft.Extensions.Logging; +using ILogger = Microsoft.Extensions.Logging.ILogger; namespace ErsatzTV.Application.Libraries; public abstract class CallLibraryScannerHandler( IDbContextFactory dbContextFactory, IConfigElementRepository configElementRepository, - IRuntimeInfo runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) { protected static string GetBaseUrl(Guid scanId) => $"http://localhost:{Settings.UiPort}/api/scan/{scanId}"; @@ -42,6 +45,7 @@ public abstract class CallLibraryScannerHandler( if (process.ExitCode != 0) { + logger.LogWarning("ErsatzTV.Scanner exited with code {ExitCode}", process.ExitCode); return BaseError.New($"ErsatzTV.Scanner exited with code {process.ExitCode}"); } } @@ -64,7 +68,7 @@ public abstract class CallLibraryScannerHandler( // writes in UTC LogEvent logEvent = LogEventReader.ReadFromString(s); - ILogger log = Log.Logger; + Serilog.ILogger log = Log.Logger; if (logEvent.Properties.TryGetValue("SourceContext", out LogEventPropertyValue property)) { log = log.ForContext( diff --git a/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs b/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs index 60fffb439..be98f3a3c 100644 --- a/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs +++ b/ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs @@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.MediaSources; @@ -22,8 +23,9 @@ public class CallLocalLibraryScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) - : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Plex/Commands/CallPlexCollectionScannerHandler.cs b/ErsatzTV.Application/Plex/Commands/CallPlexCollectionScannerHandler.cs index d79c45108..16506cab9 100644 --- a/ErsatzTV.Application/Plex/Commands/CallPlexCollectionScannerHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/CallPlexCollectionScannerHandler.cs @@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Plex; @@ -21,7 +22,12 @@ public class CallPlexCollectionScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) : base( + dbContextFactory, + configElementRepository, + runtimeInfo, + logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs b/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs index 894a4674b..dd1914bc1 100644 --- a/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs @@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Plex; @@ -22,8 +23,9 @@ public class CallPlexLibraryScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) - : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Plex/Commands/CallPlexNetworkScannerHandler.cs b/ErsatzTV.Application/Plex/Commands/CallPlexNetworkScannerHandler.cs index 7850b36c0..3d91b6436 100644 --- a/ErsatzTV.Application/Plex/Commands/CallPlexNetworkScannerHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/CallPlexNetworkScannerHandler.cs @@ -10,6 +10,7 @@ using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using ErsatzTV.Infrastructure.Extensions; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Plex; @@ -22,7 +23,9 @@ public class CallPlexNetworkScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; } diff --git a/ErsatzTV.Application/Plex/Commands/CallPlexShowScannerHandler.cs b/ErsatzTV.Application/Plex/Commands/CallPlexShowScannerHandler.cs index 1cac69ef5..5f79ba74f 100644 --- a/ErsatzTV.Application/Plex/Commands/CallPlexShowScannerHandler.cs +++ b/ErsatzTV.Application/Plex/Commands/CallPlexShowScannerHandler.cs @@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories; using ErsatzTV.FFmpeg.Runtime; using ErsatzTV.Infrastructure.Data; using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; namespace ErsatzTV.Application.Plex; @@ -19,8 +20,9 @@ public class CallPlexShowScannerHandler : CallLibraryScannerHandler dbContextFactory, IConfigElementRepository configElementRepository, IScannerProxyService scannerProxyService, - IRuntimeInfo runtimeInfo) - : base(dbContextFactory, configElementRepository, runtimeInfo) + IRuntimeInfo runtimeInfo, + ILogger logger) + : base(dbContextFactory, configElementRepository, runtimeInfo, logger) { _scannerProxyService = scannerProxyService; }