diff --git a/src/EthernaVideoImporter.Core/EthernaVideoImporter.Core.csproj b/src/EthernaVideoImporter.Core/EthernaVideoImporter.Core.csproj index 8c9cfde..2db89a3 100644 --- a/src/EthernaVideoImporter.Core/EthernaVideoImporter.Core.csproj +++ b/src/EthernaVideoImporter.Core/EthernaVideoImporter.Core.csproj @@ -29,7 +29,7 @@ - + all @@ -46,7 +46,7 @@ runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/EthernaVideoImporter.Devcon/EthernaVideoImporter.Devcon.csproj b/src/EthernaVideoImporter.Devcon/EthernaVideoImporter.Devcon.csproj index 1a1bbad..06174d8 100644 --- a/src/EthernaVideoImporter.Devcon/EthernaVideoImporter.Devcon.csproj +++ b/src/EthernaVideoImporter.Devcon/EthernaVideoImporter.Devcon.csproj @@ -37,7 +37,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - + diff --git a/src/EthernaVideoImporter.Devcon/Program.cs b/src/EthernaVideoImporter.Devcon/Program.cs index 4c7ae29..6324b25 100644 --- a/src/EthernaVideoImporter.Devcon/Program.cs +++ b/src/EthernaVideoImporter.Devcon/Program.cs @@ -261,13 +261,7 @@ static async Task Main(string[] args) }, useBeeNativeNode, authResult.RefreshTokenHandler); - services.AddTransient(_ => - ffMpegHwAcceleration switch - { - FFMpegHwAccelerations.None => new YoutubeClient(), - FFMpegHwAccelerations.Cuda => new YoutubeClient("cuda"), - _ => throw new InvalidOperationException() - }); + services.AddTransient(); services.AddTransient(); services.AddTransient(); diff --git a/src/EthernaVideoImporter/Program.cs b/src/EthernaVideoImporter/Program.cs index 366900f..7b405e6 100644 --- a/src/EthernaVideoImporter/Program.cs +++ b/src/EthernaVideoImporter/Program.cs @@ -308,7 +308,8 @@ static async Task Main(string[] args) services.AddSingleton, YouTubeChannelVideoProviderOptionsValidation>(); //services - AddYoutubeDownloader(services, ffMpegHwAcceleration); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); break; case SourceType.YouTubeVideo: @@ -320,7 +321,8 @@ static async Task Main(string[] args) services.AddSingleton, YouTubeSingleVideoProviderOptionsValidation>(); //services - AddYoutubeDownloader(services, ffMpegHwAcceleration); + services.AddTransient(); + services.AddTransient(); services.AddTransient(); break; default: @@ -340,20 +342,5 @@ await importer.RunAsync( userEthAddr, unpinRemovedVideos); } - - // Helpers. - private static void AddYoutubeDownloader( - ServiceCollection services, - FFMpegHwAccelerations hwAcceleration) - { - services.AddTransient(_ => - hwAcceleration switch - { - FFMpegHwAccelerations.None => new YoutubeClient(), - FFMpegHwAccelerations.Cuda => new YoutubeClient("cuda"), - _ => throw new InvalidOperationException() - }); - services.AddTransient(); - } } }