forked from sim0n00ps/OF-DL
Tweaked console outputs and some logging
This commit is contained in:
parent
c170bba96c
commit
a1dce61b33
@ -21,7 +21,7 @@ public class CajetanDownloadEventHandler : ICajetanDownloadEventHandler
|
||||
=> _eventHandler.OnMessage(message);
|
||||
|
||||
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)
|
||||
=> _eventHandler.OnNoContentFound(contentType);
|
||||
|
||||
@ -152,7 +152,11 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
|
||||
LoggerWithConfigContext(_configService.CurrentConfig, _cajetanConfig)
|
||||
.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)
|
||||
{
|
||||
@ -182,17 +186,19 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
DateTime userEndTime = DateTime.Now;
|
||||
TimeSpan userTotalTime = userEndTime - userStartTime;
|
||||
|
||||
Log.ForContext("Paid Posts", newResults.PaidPostCount)
|
||||
.ForContext("Posts", newResults.PostCount)
|
||||
Log.ForContext("Posts", newResults.PostCount)
|
||||
.ForContext("PaidPosts", newResults.PaidPostCount)
|
||||
.ForContext("AllPosts", newResults.PostCount + newResults.PaidPostCount)
|
||||
.ForContext("Archived", newResults.ArchivedCount)
|
||||
.ForContext("Streams", newResults.StreamsCount)
|
||||
.ForContext("Stories", newResults.StoriesCount)
|
||||
.ForContext("Highlights", newResults.HighlightsCount)
|
||||
.ForContext("Messages", newResults.MessagesCount)
|
||||
.ForContext("Paid Messages", newResults.PaidMessagesCount)
|
||||
.ForContext("PaidMessages", newResults.PaidMessagesCount)
|
||||
.ForContext("AllMessages", newResults.MessagesCount + newResults.PaidMessagesCount)
|
||||
.ForContext("Username", username)
|
||||
.ForContext("TotalMinutes", userTotalTime.TotalMinutes)
|
||||
.Information("Scraped Data for '{Username:l}', took {TotalMinutes:0.000} minutes");
|
||||
.Information("Scraped Data for '{Username:l}', took {TotalMinutes:0.000} minutes [P: {AllPosts}] [M: {AllMessages}]");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -209,16 +215,18 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
|
||||
eventHandler.OnScrapeComplete(totalTime);
|
||||
|
||||
Log.ForContext("Paid Posts", totalResults.PaidPostCount)
|
||||
.ForContext("Posts", totalResults.PostCount)
|
||||
Log.ForContext("Posts", totalResults.PostCount)
|
||||
.ForContext("PaidPosts", totalResults.PaidPostCount)
|
||||
.ForContext("AllPosts", totalResults.PostCount + totalResults.PaidPostCount)
|
||||
.ForContext("Archived", totalResults.ArchivedCount)
|
||||
.ForContext("Streams", totalResults.StreamsCount)
|
||||
.ForContext("Stories", totalResults.StoriesCount)
|
||||
.ForContext("Highlights", totalResults.HighlightsCount)
|
||||
.ForContext("Messages", totalResults.MessagesCount)
|
||||
.ForContext("Paid Messages", totalResults.PaidMessagesCount)
|
||||
.ForContext("PaidMessages", totalResults.PaidMessagesCount)
|
||||
.ForContext("AllMessages", totalResults.MessagesCount + totalResults.PaidMessagesCount)
|
||||
.ForContext("TotalMinutes", totalTime.TotalMinutes)
|
||||
.Information("Scrape Completed in {TotalMinutes:0.00} minutes");
|
||||
.Information("Scrape Completed in {TotalMinutes:0.00} minutes [P: {AllPosts}] [M: {AllMessages}]");
|
||||
|
||||
await Task.Delay(2000);
|
||||
}
|
||||
@ -322,7 +330,7 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
continue;
|
||||
|
||||
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") ?? [];
|
||||
|
||||
@ -373,7 +381,7 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
async Task FetchUsersAsync()
|
||||
{
|
||||
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);
|
||||
AddToResult(activeSubs);
|
||||
@ -381,7 +389,7 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
if (currentConfig.IncludeExpiredSubscriptions)
|
||||
{
|
||||
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);
|
||||
AddToResult(expiredSubs);
|
||||
@ -410,7 +418,7 @@ internal class Worker(IServiceProvider serviceProvider)
|
||||
|
||||
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);
|
||||
|
||||
AnsiConsole.WriteLine();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user