Browse Source

always log scanner exit code when it is non-zero (#2670)

* always log scanner exit code when it is non-zero

* remove test abort
pull/2671/head
Jason Dove 1 month ago committed by GitHub
parent
commit
bcea96d53a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 8
      ErsatzTV.Application/Emby/Commands/CallEmbyCollectionScannerHandler.cs
  3. 6
      ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs
  4. 6
      ErsatzTV.Application/Emby/Commands/CallEmbyShowScannerHandler.cs
  5. 8
      ErsatzTV.Application/Jellyfin/Commands/CallJellyfinCollectionScannerHandler.cs
  6. 6
      ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs
  7. 6
      ErsatzTV.Application/Jellyfin/Commands/CallJellyfinShowScannerHandler.cs
  8. 8
      ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs
  9. 6
      ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs
  10. 8
      ErsatzTV.Application/Plex/Commands/CallPlexCollectionScannerHandler.cs
  11. 6
      ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs
  12. 5
      ErsatzTV.Application/Plex/Commands/CallPlexNetworkScannerHandler.cs
  13. 6
      ErsatzTV.Application/Plex/Commands/CallPlexShowScannerHandler.cs

1
CHANGELOG.md

@ -89,6 +89,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -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

8
ErsatzTV.Application/Emby/Commands/CallEmbyCollectionScannerHandler.cs

@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<Synchr @@ -21,7 +22,12 @@ public class CallEmbyCollectionScannerHandler : CallLibraryScannerHandler<Synchr
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallEmbyCollectionScannerHandler> logger) : base(
dbContextFactory,
configElementRepository,
runtimeInfo,
logger)
{
_scannerProxyService = scannerProxyService;
}

6
ErsatzTV.Application/Emby/Commands/CallEmbyLibraryScannerHandler.cs

@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<ISynchron @@ -22,8 +23,9 @@ public class CallEmbyLibraryScannerHandler : CallLibraryScannerHandler<ISynchron
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallEmbyLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

6
ErsatzTV.Application/Emby/Commands/CallEmbyShowScannerHandler.cs

@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories; @@ -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<SynchronizeE @@ -19,8 +20,9 @@ public class CallEmbyShowScannerHandler : CallLibraryScannerHandler<SynchronizeE
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallEmbyShowScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

8
ErsatzTV.Application/Jellyfin/Commands/CallJellyfinCollectionScannerHandler.cs

@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<Sy @@ -21,7 +22,12 @@ public class CallJellyfinCollectionScannerHandler : CallLibraryScannerHandler<Sy
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallJellyfinCollectionScannerHandler> logger) : base(
dbContextFactory,
configElementRepository,
runtimeInfo,
logger)
{
_scannerProxyService = scannerProxyService;
}

6
ErsatzTV.Application/Jellyfin/Commands/CallJellyfinLibraryScannerHandler.cs

@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<ISync @@ -22,8 +23,9 @@ public class CallJellyfinLibraryScannerHandler : CallLibraryScannerHandler<ISync
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallJellyfinLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

6
ErsatzTV.Application/Jellyfin/Commands/CallJellyfinShowScannerHandler.cs

@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories; @@ -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<Synchron @@ -19,8 +20,9 @@ public class CallJellyfinShowScannerHandler : CallLibraryScannerHandler<Synchron
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallJellyfinShowScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

8
ErsatzTV.Application/Libraries/Commands/CallLibraryScannerHandler.cs

@ -11,13 +11,16 @@ using Serilog; @@ -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<TRequest>(
IDbContextFactory<TvContext> 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<TRequest>( @@ -42,6 +45,7 @@ public abstract class CallLibraryScannerHandler<TRequest>(
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<TRequest>( @@ -64,7 +68,7 @@ public abstract class CallLibraryScannerHandler<TRequest>(
// 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(

6
ErsatzTV.Application/MediaSources/Commands/CallLocalLibraryScannerHandler.cs

@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<IScanLoc @@ -22,8 +23,9 @@ public class CallLocalLibraryScannerHandler : CallLibraryScannerHandler<IScanLoc
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallLocalLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

8
ErsatzTV.Application/Plex/Commands/CallPlexCollectionScannerHandler.cs

@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<Synchr @@ -21,7 +22,12 @@ public class CallPlexCollectionScannerHandler : CallLibraryScannerHandler<Synchr
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexCollectionScannerHandler> logger) : base(
dbContextFactory,
configElementRepository,
runtimeInfo,
logger)
{
_scannerProxyService = scannerProxyService;
}

6
ErsatzTV.Application/Plex/Commands/CallPlexLibraryScannerHandler.cs

@ -9,6 +9,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<ISynchron @@ -22,8 +23,9 @@ public class CallPlexLibraryScannerHandler : CallLibraryScannerHandler<ISynchron
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexLibraryScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

5
ErsatzTV.Application/Plex/Commands/CallPlexNetworkScannerHandler.cs

@ -10,6 +10,7 @@ using ErsatzTV.FFmpeg.Runtime; @@ -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<Synchroni @@ -22,7 +23,9 @@ public class CallPlexNetworkScannerHandler : CallLibraryScannerHandler<Synchroni
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo) : base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexNetworkScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

6
ErsatzTV.Application/Plex/Commands/CallPlexShowScannerHandler.cs

@ -7,6 +7,7 @@ using ErsatzTV.Core.Interfaces.Repositories; @@ -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<SynchronizeP @@ -19,8 +20,9 @@ public class CallPlexShowScannerHandler : CallLibraryScannerHandler<SynchronizeP
IDbContextFactory<TvContext> dbContextFactory,
IConfigElementRepository configElementRepository,
IScannerProxyService scannerProxyService,
IRuntimeInfo runtimeInfo)
: base(dbContextFactory, configElementRepository, runtimeInfo)
IRuntimeInfo runtimeInfo,
ILogger<CallPlexShowScannerHandler> logger)
: base(dbContextFactory, configElementRepository, runtimeInfo, logger)
{
_scannerProxyService = scannerProxyService;
}

Loading…
Cancel
Save