bug: fix the finish scan event

This commit is contained in:
Guillermo Marcel 2025-05-07 15:14:08 -03:00
parent 66aa064e2f
commit b11aac2857
4 changed files with 10 additions and 6 deletions

View File

@ -72,7 +72,7 @@ public class AutoScanApp
.AddJob(downloaderJob)
.AddJob(scannerJob)
.AddJob(cleanJob)
.OnFinish(OnScanCompleted)
.OnFinish(() => OnScanCompleted?.Invoke() ?? Task.CompletedTask)
.Build();
_scheduler.ListenerManager.AddJobListener(chainer, GroupMatcher<JobKey>.GroupEquals(GROUP_NAME));
@ -99,7 +99,7 @@ public class AutoScanApp
public string? GetVideoPath(string name)
{
var path = Path.Combine(_options.Scanner.DetectionFolder, name + ".avi");
var path = Path.Combine(_options.Scanner.DetectionFolder, name + ".mp4");
if (!File.Exists(path))
{
return null;

View File

@ -66,7 +66,7 @@ public class DVRScanner : IDVRScanner
_logger.LogDebug("DVR Process started with ID: {Id}", process.Id);
await UpdateProcessUntilExits(process, cancellationToken);
_logger.LogInformation("Videos scanned successfully!");
_logger.LogInformation("Videos scanned successfully after {Duration}", DateTime.Now - _startedAt);;
//Count the number of .avi files and .jpg files in the detection folder
var aviFiles = Directory.GetFiles(_options.Scanner.DetectionFolder!, "*.avi");

View File

@ -56,7 +56,11 @@ public class ChainerListener : JobListenerSupport
if (_chainLinks.ContainsValue(context.JobDetail.Key))
{
_logger.LogInformation("Job '{JobKey}' is the last in the chain", context.JobDetail.Key);
if (OnJobChainFinished is not null)
if (OnJobChainFinished is null)
{
_logger.LogWarning("There is no OnJobChainFinished event to trigger");
return;
}
await OnJobChainFinished.Invoke();
return;
}

View File

@ -46,8 +46,8 @@ output-dir = .\media\detected
# Method of generating output videos. Possible values are: SCAN_ONLY, OPENCV,
# FFMPEG, COPY. Not all features are supported in FFMPEG/COPY mode.
#output-mode = OPENCV
output-mode = OPENCV
#output-mode = COPY
# Arguments to add before the input when calling ffmpeg in output-mode FFMPEG