Merge pull request 'fix: logs' (#13) from release/V1.0.0 into main
Some checks failed
Build and Deploy ASP.NET API / build-and-deploy (push) Has been cancelled
Some checks failed
Build and Deploy ASP.NET API / build-and-deploy (push) Has been cancelled
Reviewed-on: http://git.carneiro.ddnsfree.com/ricardo/YTExtractor/pulls/13
This commit is contained in:
commit
6a86d8b7c6
@ -108,7 +108,7 @@ namespace YTExtractor.Logging.Configuration
|
||||
Console.WriteLine($"🌐 Conectividade com Seq OK: {seqUrl}");
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
Console.WriteLine($"⚠️ Seq configurado mas pode não estar respondendo: {response.StatusCode}");
|
||||
}
|
||||
}
|
||||
@ -119,27 +119,4 @@ namespace YTExtractor.Logging.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//public static class SerilogConfiguration
|
||||
//{
|
||||
// public static LoggerConfiguration SetLoggerConfiguration(this WebApplicationBuilder builder, LoggerConfiguration config, IServiceProvider services, IConfiguration configuration)
|
||||
// {
|
||||
// var workspace = configuration["Serilog:Properties:Workspace"];
|
||||
// var seqServer = configuration.GetValue<string>("Serilog:WriteTo:2:Args:serverUrl"); ;
|
||||
|
||||
// config
|
||||
// .ReadFrom.Configuration(configuration)
|
||||
// .ReadFrom.Services(services)
|
||||
// .Enrich.FromLogContext()
|
||||
// .Enrich.WithEnvironmentName()
|
||||
// //.Enrich.WithMachineName()
|
||||
// .Enrich.WithProperty("Application", "SumaTube")
|
||||
// .Enrich.WithProperty("Workspace", workspace)
|
||||
// .WriteTo.Seq(seqServer)
|
||||
// ;
|
||||
|
||||
// return config;
|
||||
// }
|
||||
|
||||
//}
|
||||
}
|
||||
|
||||
@ -42,9 +42,11 @@ app.MapPost("/api/video-info", async (VideoRequest request, MongoDBConnector mon
|
||||
{
|
||||
try
|
||||
{
|
||||
Log.Information("Requisição recebida");
|
||||
if (!youtubeService.IsValidYouTubeUrl(request.Url))
|
||||
return Results.BadRequest("Invalid YouTube URL");
|
||||
|
||||
Log.Information("Obtendo pasta atual");
|
||||
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
|
||||
Directory.CreateDirectory(tempDir);
|
||||
|
||||
@ -52,9 +54,11 @@ app.MapPost("/api/video-info", async (VideoRequest request, MongoDBConnector mon
|
||||
{
|
||||
Log.Information($"Obtendo dados do video: {request.Url}");
|
||||
var service = new ConvertTranscriptService();
|
||||
Log.Information("Obtendo dados da url no mongo");
|
||||
var videoExists = await mongo.GetVideoByUrl(request.Url);
|
||||
if (videoExists != null)
|
||||
{
|
||||
Log.Information($"Retorno via mongo db da url: {request.Url}");
|
||||
return Results.Ok(new VideoInfo(
|
||||
videoExists.Url,
|
||||
videoExists.Titulo,
|
||||
@ -63,9 +67,11 @@ app.MapPost("/api/video-info", async (VideoRequest request, MongoDBConnector mon
|
||||
));
|
||||
}
|
||||
|
||||
Log.Information("Obtendo dados da url na api do youtube");
|
||||
var info = await youtubeService.GetVideoInfo(request.Url, tempDir);
|
||||
var subtitles = service.ExtractPlainText(await youtubeService.GetSubtitles(request.Url, request.Language, tempDir));
|
||||
|
||||
Log.Information("Guardar no mongodb");
|
||||
await mongo.InsertVideo(new VideoData
|
||||
{
|
||||
Id = Guid.NewGuid().ToString(),
|
||||
|
||||
Loading…
Reference in New Issue
Block a user