Compare commits
3 Commits
ba1021c5e6
...
513a9d6d45
Author | SHA1 | Date | |
---|---|---|---|
513a9d6d45 | |||
a0cc6ec55f | |||
85ac367e0c |
@ -79,6 +79,7 @@ public class AutoScanApp
|
|||||||
|
|
||||||
await _scheduler.ScheduleJob(downloaderJob, trigger, cancellationToken);
|
await _scheduler.ScheduleJob(downloaderJob, trigger, cancellationToken);
|
||||||
await _scheduler.AddJob(scannerJob, false, true, cancellationToken);
|
await _scheduler.AddJob(scannerJob, false, true, cancellationToken);
|
||||||
|
await _scheduler.AddJob(cleanJob, false, true, cancellationToken);
|
||||||
|
|
||||||
_logger.LogDebug("Scheduled job successfully!");
|
_logger.LogDebug("Scheduled job successfully!");
|
||||||
}
|
}
|
||||||
|
@ -48,6 +48,8 @@ public class DVRScanner : IDVRScanner
|
|||||||
_logger.LogInformation("Dry run enabled, skipping execution...");
|
_logger.LogInformation("Dry run enabled, skipping execution...");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CleanDetectionFiles();
|
||||||
_startedAt = DateTime.Now;
|
_startedAt = DateTime.Now;
|
||||||
process.Start();
|
process.Start();
|
||||||
// process.PriorityClass = ProcessPriorityClass.High;
|
// process.PriorityClass = ProcessPriorityClass.High;
|
||||||
@ -66,7 +68,6 @@ public class DVRScanner : IDVRScanner
|
|||||||
await UpdateProcessUntilExits(process, cancellationToken);
|
await UpdateProcessUntilExits(process, cancellationToken);
|
||||||
_logger.LogInformation("Videos scanned successfully!");
|
_logger.LogInformation("Videos scanned successfully!");
|
||||||
|
|
||||||
RemoveVideoFiles();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -87,16 +88,19 @@ public class DVRScanner : IDVRScanner
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RemoveVideoFiles()
|
private void CleanDetectionFiles()
|
||||||
{
|
{
|
||||||
|
if (_options.Scanner?.DetectionFolder is null)
|
||||||
|
return;
|
||||||
|
if (_options.Scanner!.RunDry)
|
||||||
|
return;
|
||||||
|
|
||||||
//remove .avi files from the detection folder
|
//remove .avi files from the detection folder
|
||||||
if (_options.Scanner?.DetectionFolder is not null && !_options.Scanner.RunDry)
|
_logger.LogDebug("Removing .avi files from detection folder {DetectionFolder}", _options.Scanner.DetectionFolder);
|
||||||
|
foreach (var file in Directory.GetFiles(_options.Scanner!.DetectionFolder!, "*"))
|
||||||
{
|
{
|
||||||
_logger.LogDebug("Removing .avi files from detection folder {DetectionFolder}", _options.Scanner.DetectionFolder);
|
File.Delete(file);
|
||||||
foreach (var file in Directory.GetFiles(_options.Scanner.DetectionFolder, "*.avi"))
|
|
||||||
{
|
|
||||||
File.Delete(file);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -34,11 +34,32 @@ public class CleanJob : IJob
|
|||||||
|
|
||||||
private void CleanOriginalFiles()
|
private void CleanOriginalFiles()
|
||||||
{
|
{
|
||||||
|
if (_options.MediaFolder is not null)
|
||||||
|
return;
|
||||||
|
if (_options.RunDry)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//remove .mp4 files from the media folder
|
||||||
|
_logger.LogDebug("Removing .mp4 files from media folder {MediaFolder}", _options.MediaFolder);
|
||||||
|
foreach (var file in Directory.GetFiles(_options.MediaFolder!, "*.mp4"))
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CleanDetectionFiles()
|
private void CleanDetectionFiles()
|
||||||
{
|
{
|
||||||
|
if (_options.Scanner?.DetectionFolder is not null)
|
||||||
|
return;
|
||||||
|
if (_options.Scanner!.RunDry)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//remove .avi files from the detection folder
|
||||||
|
_logger.LogDebug("Removing .avi files from detection folder {DetectionFolder}", _options.Scanner.DetectionFolder);
|
||||||
|
foreach (var file in Directory.GetFiles(_options.Scanner!.DetectionFolder!, "*.avi"))
|
||||||
|
{
|
||||||
|
File.Delete(file);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user