Directory.Packages.props
+1
-0
diff --git a/Directory.Packages.props b/Directory.Packages.props
index c562d5d..a9d4f33 100644
@@ -52,5 +52,6 @@
<PackageVersion Include="Quartz" Version="3.18.1" />
<PackageVersion Include="Quartz.AspNetCore" Version="3.18.1" />
<PackageVersion Include="SubtitlesParserV2" Version="2.4.0" />
<PackageVersion Include="Winton.Extensions.Configuration.Consul" Version="3.4.0" />
</ItemGroup>
</Project>
src/Api/Api.csproj
+1
-0
diff --git a/src/Api/Api.csproj b/src/Api/Api.csproj
index 7d78a9c..7184c08 100644
@@ -21,5 +21,6 @@
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" />
<PackageReference Include="Quartz" />
<PackageReference Include="Quartz.AspNetCore" />
<PackageReference Include="Winton.Extensions.Configuration.Consul" />
</ItemGroup>
</Project>
src/Api/Program.cs
+10
-0
diff --git a/src/Api/Program.cs b/src/Api/Program.cs
index 52ea166..b1b3b3e 100644
@@ -7,9 +7,19 @@ using Slopper.Domain;
using Slopper.Infrastructure.Ai;
using Slopper.Infrastructure.Database;
using Slopper.Infrastructure.Ffmpeg;
using Winton.Extensions.Configuration.Consul;
var builder = WebApplication.CreateBuilder(args);
builder.Configuration.AddConsul(
"slopper",
options =>
{
options.ConsulConfigurationOptions = options => options.Address = new(builder.Configuration["Consul:Address"]!);
options.ReloadOnChange = true;
}
);
builder.ConfigureOpenTelemetry();
builder.Services.AddOpenApi();
src/Api/packages.lock.json
+22
-0
diff --git a/src/Api/packages.lock.json b/src/Api/packages.lock.json
index b2966a7..940f8e5 100644
@@ -96,6 +96,23 @@
"Quartz.Extensions.Hosting": "3.18.1"
}
},
"Winton.Extensions.Configuration.Consul": {
"type": "Direct",
"requested": "[3.4.0, )",
"resolved": "3.4.0",
"contentHash": "9oS0jui5YYsMECzp5I69QKojEZK+FMG3KAOXTggZf3lxg4Nx/eRB648TOXIlVBxpJ1aFEQGklHdKke1oozexUQ==",
"dependencies": {
"Consul": "1.6.10.8"
}
},
"Consul": {
"type": "Transitive",
"resolved": "1.6.10.8",
"contentHash": "taptCkZ3CafAmwpp4ate7QDU4ZmdgsdeP6mFzfNDLcMGgUNTM/ChB48pFD782t63qs8UlqGMO9uN9n8aNjGEDg==",
"dependencies": {
"Newtonsoft.Json": "13.0.1"
}
},
"Instances": {
"type": "Transitive",
"resolved": "3.0.2",
@@ -375,6 +392,11 @@
"resolved": "3.3.1",
"contentHash": "8Xo42prPRLeQpcSv9sjajQQ0o+gL7rZ4HMUsNNI47iqK+bxDrIwLOGlN9fLAlTpJk0iyXRNR51zupMt5IdhU/w=="
},
"Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.1",
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
},
"OpenTelemetry.Api": {
"type": "Transitive",
"resolved": "1.15.3",
src/Cli/Cli.csproj
+1
-0
diff --git a/src/Cli/Cli.csproj b/src/Cli/Cli.csproj
index 0109a40..fe6f23e 100644
@@ -26,5 +26,6 @@
<PackageReference Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" />
<PackageReference Include="Winton.Extensions.Configuration.Consul" />
</ItemGroup>
</Project>
src/Cli/Program.cs
+31
-10
diff --git a/src/Cli/Program.cs b/src/Cli/Program.cs
index f7c6dc4..412d1ae 100644
@@ -1,32 +1,53 @@
using System;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Slopper.Cli;
using Slopper.Domain;
using Slopper.Infrastructure.Ai;
using Slopper.Infrastructure.Database;
using Slopper.Infrastructure.Ffmpeg;
using Winton.Extensions.Configuration.Consul;
var builder = Host.CreateApplicationBuilder();
builder.Configuration.AddConsul(
"slopper",
options =>
{
options.ConsulConfigurationOptions = options => options.Address = new(builder.Configuration["Consul:Address"]!);
options.ConsulHttpClientOptions = client =>
client.DefaultRequestHeaders.Authorization = new("Basic", builder.Configuration["Consul:BasicAuth"]);
options.ReloadOnChange = true;
options.PollWaitTime = TimeSpan.FromSeconds(5);
}
);
builder.ConfigureOpenTelemetry();
builder.Services.AddClipSelector().AddClipGenerator();
builder.Services.AddJellyfinDatabase().AddSlopperDatabase().AddFfmpegServices().AddAi();
builder.Services.AddOptions<TestOption>().BindConfiguration("");
using var app = builder.Build();
await app.StartAsync();
var options = app.Services.GetRequiredService<IOptionsMonitor<TestOption>>();
var logger = app.Services.GetRequiredService<ILogger<Program>>();
var lifetime = app.Services.GetRequiredService<IHostApplicationLifetime>();
using var scope = app.Services.CreateScope();
var clipDescriber = scope.ServiceProvider.GetRequiredService<ClipDescriber>();
var description = await clipDescriber.DescribeClip(
new(Guid.NewGuid(), args[0], new Subtitles.Embedded(2)),
TimeSpan.FromSeconds(239),
TimeSpan.FromSeconds(40),
CancellationToken.None
);
logger.LogInformation("{Description}", description);
do
{
logger.LogInformation("Consul: {Description}", options.CurrentValue.ConsulOptionForSlopper);
await Task.Delay(TimeSpan.FromSeconds(5));
} while (!lifetime.ApplicationStopping.IsCancellationRequested);
class TestOption
{
public required string ConsulOptionForSlopper { get; set; }
}
src/Cli/packages.lock.json
+24
-0
diff --git a/src/Cli/packages.lock.json b/src/Cli/packages.lock.json
index d1a0770..5b0fb25 100644
@@ -88,6 +88,25 @@
"OpenTelemetry.Api": "[1.15.3, 2.0.0)"
}
},
"Winton.Extensions.Configuration.Consul": {
"type": "Direct",
"requested": "[3.4.0, )",
"resolved": "3.4.0",
"contentHash": "9oS0jui5YYsMECzp5I69QKojEZK+FMG3KAOXTggZf3lxg4Nx/eRB648TOXIlVBxpJ1aFEQGklHdKke1oozexUQ==",
"dependencies": {
"Consul": "1.6.10.8",
"Microsoft.Extensions.Configuration": "3.0.0",
"Microsoft.Extensions.Configuration.Json": "3.0.0"
}
},
"Consul": {
"type": "Transitive",
"resolved": "1.6.10.8",
"contentHash": "taptCkZ3CafAmwpp4ate7QDU4ZmdgsdeP6mFzfNDLcMGgUNTM/ChB48pFD782t63qs8UlqGMO9uN9n8aNjGEDg==",
"dependencies": {
"Newtonsoft.Json": "13.0.1"
}
},
"Instances": {
"type": "Transitive",
"resolved": "3.0.2",
@@ -370,6 +389,11 @@
"resolved": "11.0.0-preview.3.26207.106",
"contentHash": "IBOlwyX13ax6/fXA7AoZFswKFytta9TExBv3/8qemMJGBoDXYlQEcw4WerHQCvmerJ5uP2o8bjIAvxcNdTZVLQ=="
},
"Newtonsoft.Json": {
"type": "Transitive",
"resolved": "13.0.1",
"contentHash": "ppPFpBcvxdsfUonNcvITKqLl3bqxWbDCZIzDWHzjpdAHRFfZe0Dw9HmA0+za13IdyrgJwpkDTDA9fHaxOrt20A=="
},
"OpenTelemetry.Api": {
"type": "Transitive",
"resolved": "1.15.3",