-
Notifications
You must be signed in to change notification settings - Fork 0
/
ServiceCollectionExtensions.cs
38 lines (34 loc) · 1.33 KB
/
ServiceCollectionExtensions.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using dis.Features.Common;
using dis.Features.Conversion;
using dis.Features.Conversion.Models;
using dis.Features.Download;
using dis.Features.Download.Models;
using dis.Features.Download.Models.Interfaces;
using Microsoft.AspNetCore.StaticFiles;
using Microsoft.Extensions.DependencyInjection;
using Serilog.Core;
namespace dis;
public static class ServiceCollectionExtensions
{
public static void AddMyServices(this IServiceCollection services)
{
services.AddSingleton<Globals>();
services.AddSingleton<ValidResolutions>();
services.AddSingleton<VideoCodecs>();
services.AddSingleton<FileExtensionContentTypeProvider>();
services.AddSingleton<RootCommand>();
services.AddSingleton<IDownloaderFactory, VideoDownloaderFactory>();
services.AddTransient<CodecParser>();
services.AddTransient<StreamConfigurator>();
services.AddTransient<ProcessHandler>();
services.AddTransient<PathHandler>();
services.AddTransient<Converter>();
services.AddTransient<LoggingLevelSwitch>();
services.AddTransient<IDownloader, DownloadCreator>();
services.AddSingleton<IDownloaderFactory>(sp =>
{
var globals = sp.GetRequiredService<Globals>();
return new VideoDownloaderFactory(globals.YoutubeDl);
});
}
}