Updated scanner and table names.
All checks were successful
ci / build-test (push) Successful in 2m38s
ci / publish-image (push) Has been skipped

This commit is contained in:
2026-03-05 20:56:57 -05:00
parent 79bece9e1c
commit 61f2e64972
12 changed files with 79 additions and 17 deletions

View File

@@ -6,7 +6,7 @@ using Microsoft.Extensions.Options;
namespace JSMR.Worker.Services;
public sealed class ScanJob(ILogger<ScanJob> log, IOptions<ScanOptions> options, ScanVoiceWorksHandler scanVoiceWorksHandler)
public sealed class ScanJob(ILogger<ScanJob> log, IOptions<ScanOptions> options, ScanVoiceWorksHandler handler)
{
private readonly ScanOptions _options = options.Value;
@@ -21,7 +21,7 @@ public sealed class ScanJob(ILogger<ScanJob> log, IOptions<ScanOptions> options,
Locale: Enum.Parse<Locale>(_options.Locale, true)
);
await scanVoiceWorksHandler.HandleAsync(request, cancellationToken);
await handler.HandleAsync(request, cancellationToken);
log.LogInformation("Scan completed.");
}

View File

@@ -1,10 +1,13 @@
using JSMR.Application.Enums;
using JSMR.Application.Scanning;
using JSMR.Application.Scanning.Ports;
using JSMR.Domain.Enums;
using JSMR.Infrastructure.Common.Time;
using JSMR.Worker.Options;
using JSMR.Worker.UI;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Spectre.Console;
using System.Globalization;
namespace JSMR.Worker.Services;
@@ -39,7 +42,17 @@ public sealed class PagedScanRunner(
using var scope = serviceProvider.CreateScope();
ScanVoiceWorksHandler handler = scope.ServiceProvider.GetRequiredService<ScanVoiceWorksHandler>();
log.LogInformation("Scanning page {Page} (size {Size}, locale {Locale})…", currentPage, pageSize, locale);
//log.LogInformation("Scanning page {Page} (size {Size}, locale {Locale})…", currentPage, pageSize, locale);
CliUi.PageHeader(currentPage, end);
//AnsiConsole.Status()
//.Start($"[grey]Scanning page[/] [bold]{currentPage}[/] [grey]of[/] [bold]{end}[/][grey]...[/]", ctx =>
//{
// // Simulate grinding
// Thread.Sleep(3000);
//});
//AnsiConsole.MarkupLine($"[green]✓ Scanning page[/] [bold]{currentPage}[/] [grey]of[/] [bold]{end}[/][grey]... DONE[/]");
ScanVoiceWorksRequest request = new(
PageNumber: currentPage,
@@ -49,18 +62,21 @@ public sealed class PagedScanRunner(
ScanVoiceWorksResponse response = await handler.HandleAsync(request, cancellationToken);
//int newUpcoming = response.Results.Where(x => x.IsNewUpcoming == true).Count();
int newUpcoming = response.Results.Count(x => x.UpdateStatus == VoiceWorkStatus.NewAndUpcoming);
//if (newUpcoming > 0)
// updatedInfo.Add($"{newUpcoming} new upcoming work(s)");
// AnsiConsole.MarkupLine($" - {newUpcoming} new upcoming work(s)");
//int newOnSale = result.ScannedVoiceWorks.Where(x => x.IsNewOnSale == true).Count();
int newRelease = response.Results.Count(x => x.UpdateStatus == VoiceWorkStatus.NewRelease);
//if (newOnSale > 0)
// updatedInfo.Add($"{newOnSale} new work(s) on sale");
//if (newRelease > 0)
// updatedInfo.Add($"{newRelease} new work(s) on sale");
CliUi.PageHighlights(newUpcoming, newRelease);
IEnumerable<VoiceWorkUpsertResult> resultsWithIssues = response.Results.Where(x => x.Issues.Count > 0);
// TODO: Later
//foreach (VoiceWorkUpsertResult resultWithIssues in resultsWithIssues)
//{
// log.LogWarning($"PRoblem with {resultWithIssues.}")