Tweaked console outputs

This commit is contained in:
Casper Sparre 2026-02-20 23:26:45 +01:00
parent 76aaf969ea
commit 7042afc76a
2 changed files with 10 additions and 6 deletions

View File

@ -21,7 +21,7 @@ public class CajetanDownloadEventHandler : ICajetanDownloadEventHandler
=> _eventHandler.OnMessage(message); => _eventHandler.OnMessage(message);
public void OnMessage(string message, string color) public void OnMessage(string message, string color)
=> AnsiConsole.Markup($"[{color.ToLowerInvariant()}]{Markup.Escape(message)}\n[/]"); => AnsiConsole.MarkupLine($"[{color.ToLowerInvariant()}]{Markup.Escape(message)}[/]");
public void OnNoContentFound(string contentType) public void OnNoContentFound(string contentType)
=> _eventHandler.OnNoContentFound(contentType); => _eventHandler.OnNoContentFound(contentType);

View File

@ -152,7 +152,11 @@ internal class Worker(IServiceProvider serviceProvider)
LoggerWithConfigContext(_configService.CurrentConfig, _cajetanConfig) LoggerWithConfigContext(_configService.CurrentConfig, _cajetanConfig)
.Information("Scraping Data for {UserCount} user(s)", usersToDownload.Count); .Information("Scraping Data for {UserCount} user(s)", usersToDownload.Count);
eventHandler.OnMessage($"Scraping Data for {usersToDownload.Count} user(s)\n");
eventHandler.OnMessage(
$"\nScraping Data for {usersToDownload.Count} user(s)\n" +
$"{"======================================================================================================"}\n"
);
foreach ((string username, long userId) in usersToDownload) foreach ((string username, long userId) in usersToDownload)
{ {
@ -322,7 +326,7 @@ internal class Worker(IServiceProvider serviceProvider)
continue; continue;
Log.Information("Getting Users from list '{ListName:l}' (Include Restricted: {IncludeRestrictedSubscriptions})", name, currentConfig.IncludeRestrictedSubscriptions); Log.Information("Getting Users from list '{ListName:l}' (Include Restricted: {IncludeRestrictedSubscriptions})", name, currentConfig.IncludeRestrictedSubscriptions);
AnsiConsole.Markup($"[green]Getting Users from list '{name}' (Include Restricted: {currentConfig.IncludeRestrictedSubscriptions})\n[/]"); AnsiConsole.MarkupLine($"[green]Getting Users from list '{name}' (Include Restricted: {currentConfig.IncludeRestrictedSubscriptions})[/]");
List<string> listUsernames = await _apiService.GetListUsers($"/lists/{listId}/users") ?? []; List<string> listUsernames = await _apiService.GetListUsers($"/lists/{listId}/users") ?? [];
@ -373,7 +377,7 @@ internal class Worker(IServiceProvider serviceProvider)
async Task FetchUsersAsync() async Task FetchUsersAsync()
{ {
Log.Information("Getting Active Subscriptions (Include Restricted: {IncludeRestrictedSubscriptions})", currentConfig.IncludeRestrictedSubscriptions); Log.Information("Getting Active Subscriptions (Include Restricted: {IncludeRestrictedSubscriptions})", currentConfig.IncludeRestrictedSubscriptions);
AnsiConsole.Markup($"[green]Getting Active Subscriptions (Include Restricted: {currentConfig.IncludeRestrictedSubscriptions})\n[/]"); AnsiConsole.MarkupLine($"[green]Getting Active Subscriptions (Include Restricted: {currentConfig.IncludeRestrictedSubscriptions})[/]");
Dictionary<string, long>? activeSubs = await _apiService.GetActiveSubscriptions("/subscriptions/subscribes", currentConfig.IncludeRestrictedSubscriptions); Dictionary<string, long>? activeSubs = await _apiService.GetActiveSubscriptions("/subscriptions/subscribes", currentConfig.IncludeRestrictedSubscriptions);
AddToResult(activeSubs); AddToResult(activeSubs);
@ -381,7 +385,7 @@ internal class Worker(IServiceProvider serviceProvider)
if (currentConfig.IncludeExpiredSubscriptions) if (currentConfig.IncludeExpiredSubscriptions)
{ {
Log.Information("Getting Expired Subscriptions (Include Restricted: {IncludeRestrictedSubscriptions})", currentConfig.IncludeRestrictedSubscriptions); Log.Information("Getting Expired Subscriptions (Include Restricted: {IncludeRestrictedSubscriptions})", currentConfig.IncludeRestrictedSubscriptions);
AnsiConsole.Markup($"[green]Getting Expired Subscriptions (Include Restricted: {currentConfig.IncludeRestrictedSubscriptions})\n[/]"); AnsiConsole.MarkupLine($"[green]Getting Expired Subscriptions (Include Restricted: {currentConfig.IncludeRestrictedSubscriptions})[/]");
Dictionary<string, long>? expiredSubs = await _apiService.GetExpiredSubscriptions("/subscriptions/subscribes", currentConfig.IncludeRestrictedSubscriptions); Dictionary<string, long>? expiredSubs = await _apiService.GetExpiredSubscriptions("/subscriptions/subscribes", currentConfig.IncludeRestrictedSubscriptions);
AddToResult(expiredSubs); AddToResult(expiredSubs);
@ -410,7 +414,7 @@ internal class Worker(IServiceProvider serviceProvider)
Dictionary<string, long> usersInNonNudeLists = await GetUsersFromSpecificListsAsync(result, [.. listNames]); Dictionary<string, long> usersInNonNudeLists = await GetUsersFromSpecificListsAsync(result, [.. listNames]);
AnsiConsole.Markup($"[green]Updating Non-Nude collection with {usersInNonNudeLists.Count} Users[/]"); AnsiConsole.MarkupLine($"[grey]Updating Non-Nude collection with {usersInNonNudeLists.Count} Users[/]");
await _dbService.UpdateNonNudeCollectionAsync(usersInNonNudeLists); await _dbService.UpdateNonNudeCollectionAsync(usersInNonNudeLists);
AnsiConsole.WriteLine(); AnsiConsole.WriteLine();