2025-02-15 15:55:29 -03:00
|
|
|
using AutoScan.Listener;
|
2025-02-14 20:32:04 -03:00
|
|
|
using CasaBotApp;
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
using Quartz;
|
|
|
|
|
|
|
|
namespace AutoScan;
|
|
|
|
|
|
|
|
public static class DependencyInjectionExtensions
|
|
|
|
{
|
|
|
|
public static void AddAutoScan(this IServiceCollection services)
|
|
|
|
{
|
|
|
|
services.AddSingleton<ShinobiConnector>();
|
|
|
|
services.AddSingleton<DVRScanner>();
|
|
|
|
services.AddSingleton<FfmpegWrapper>();
|
|
|
|
services.AddSingleton<AutoScanApp>();
|
|
|
|
services.AddQuartz(q =>
|
|
|
|
{
|
|
|
|
q.UseMicrosoftDependencyInjectionJobFactory();
|
|
|
|
});
|
2025-02-15 15:55:29 -03:00
|
|
|
services.AddTransient<IChainerListenerFactory, ChainerListenerFactory>();
|
2025-02-14 20:32:04 -03:00
|
|
|
|
|
|
|
services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);
|
|
|
|
|
|
|
|
services.AddSingleton<IScheduler>(sp =>
|
|
|
|
{
|
|
|
|
var schedulerFactory = sp.GetRequiredService<ISchedulerFactory>();
|
|
|
|
var tsk = schedulerFactory.GetScheduler();
|
|
|
|
tsk.Wait();
|
|
|
|
return tsk.Result;
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|