📄
src/Cli/Program.cs
using System.Threading; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Logging; using Slopper.Cli; using Slopper.Domain; using Slopper.Infrastructure.Ai; using Slopper.Infrastructure.Database; using Slopper.Infrastructure.Ffmpeg; var builder = Host.CreateApplicationBuilder(); builder.ConfigureOpenTelemetry(); builder.Services.AddClipSelector().AddClipGenerator(); builder.Services.AddJellyfinDatabase().AddSlopperDatabase().AddFfmpegServices().AddAi(); using var app = builder.Build(); await app.StartAsync(CancellationToken.None); var logger = app.Services.GetRequiredService<ILogger<Program>>(); using var scope = app.Services.CreateScope(); var clipRepository = scope.ServiceProvider.GetRequiredService<IClipRepository>(); var clips = clipRepository.GetLatest(); await foreach (var clip in clips) { logger.LogInformation("Clip {ClipId} {Path} {CreatedAt}", clip.Id, clip.Path, clip.CreatedAt); } await app.StopAsync(CancellationToken.None);