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(downloaderJob)
.AddJob(scannerJob) .AddJob(scannerJob)
.AddJob(cleanJob) .AddJob(cleanJob)
.OnFinish(OnScanCompleted) .OnFinish(() => OnScanCompleted?.Invoke() ?? Task.CompletedTask)
.Build(); .Build();
_scheduler.ListenerManager.AddJobListener(chainer, GroupMatcher<JobKey>.GroupEquals(GROUP_NAME)); _scheduler.ListenerManager.AddJobListener(chainer, GroupMatcher<JobKey>.GroupEquals(GROUP_NAME));
@ -99,7 +99,7 @@ public class AutoScanApp
public string? GetVideoPath(string name) 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)) if (!File.Exists(path))
{ {
return null; return null;

View File

@ -66,7 +66,7 @@ public class DVRScanner : IDVRScanner
_logger.LogDebug("DVR Process started with ID: {Id}", process.Id); _logger.LogDebug("DVR Process started with ID: {Id}", process.Id);
await UpdateProcessUntilExits(process, cancellationToken); 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 //Count the number of .avi files and .jpg files in the detection folder
var aviFiles = Directory.GetFiles(_options.Scanner.DetectionFolder!, "*.avi"); var aviFiles = Directory.GetFiles(_options.Scanner.DetectionFolder!, "*.avi");

View File

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

View File

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