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);
|
=> _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);
|
||||||
|
|||||||
@ -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)
|
||||||
{
|
{
|
||||||
@ -182,17 +186,19 @@ internal class Worker(IServiceProvider serviceProvider)
|
|||||||
DateTime userEndTime = DateTime.Now;
|
DateTime userEndTime = DateTime.Now;
|
||||||
TimeSpan userTotalTime = userEndTime - userStartTime;
|
TimeSpan userTotalTime = userEndTime - userStartTime;
|
||||||
|
|
||||||
Log.ForContext("Paid Posts", newResults.PaidPostCount)
|
Log.ForContext("Posts", newResults.PostCount)
|
||||||
.ForContext("Posts", newResults.PostCount)
|
.ForContext("PaidPosts", newResults.PaidPostCount)
|
||||||
|
.ForContext("AllPosts", newResults.PostCount + newResults.PaidPostCount)
|
||||||
.ForContext("Archived", newResults.ArchivedCount)
|
.ForContext("Archived", newResults.ArchivedCount)
|
||||||
.ForContext("Streams", newResults.StreamsCount)
|
.ForContext("Streams", newResults.StreamsCount)
|
||||||
.ForContext("Stories", newResults.StoriesCount)
|
.ForContext("Stories", newResults.StoriesCount)
|
||||||
.ForContext("Highlights", newResults.HighlightsCount)
|
.ForContext("Highlights", newResults.HighlightsCount)
|
||||||
.ForContext("Messages", newResults.MessagesCount)
|
.ForContext("Messages", newResults.MessagesCount)
|
||||||
.ForContext("Paid Messages", newResults.PaidMessagesCount)
|
.ForContext("PaidMessages", newResults.PaidMessagesCount)
|
||||||
|
.ForContext("AllMessages", newResults.MessagesCount + newResults.PaidMessagesCount)
|
||||||
.ForContext("Username", username)
|
.ForContext("Username", username)
|
||||||
.ForContext("TotalMinutes", userTotalTime.TotalMinutes)
|
.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)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -209,16 +215,18 @@ internal class Worker(IServiceProvider serviceProvider)
|
|||||||
|
|
||||||
eventHandler.OnScrapeComplete(totalTime);
|
eventHandler.OnScrapeComplete(totalTime);
|
||||||
|
|
||||||
Log.ForContext("Paid Posts", totalResults.PaidPostCount)
|
Log.ForContext("Posts", totalResults.PostCount)
|
||||||
.ForContext("Posts", totalResults.PostCount)
|
.ForContext("PaidPosts", totalResults.PaidPostCount)
|
||||||
|
.ForContext("AllPosts", totalResults.PostCount + totalResults.PaidPostCount)
|
||||||
.ForContext("Archived", totalResults.ArchivedCount)
|
.ForContext("Archived", totalResults.ArchivedCount)
|
||||||
.ForContext("Streams", totalResults.StreamsCount)
|
.ForContext("Streams", totalResults.StreamsCount)
|
||||||
.ForContext("Stories", totalResults.StoriesCount)
|
.ForContext("Stories", totalResults.StoriesCount)
|
||||||
.ForContext("Highlights", totalResults.HighlightsCount)
|
.ForContext("Highlights", totalResults.HighlightsCount)
|
||||||
.ForContext("Messages", totalResults.MessagesCount)
|
.ForContext("Messages", totalResults.MessagesCount)
|
||||||
.ForContext("Paid Messages", totalResults.PaidMessagesCount)
|
.ForContext("PaidMessages", totalResults.PaidMessagesCount)
|
||||||
|
.ForContext("AllMessages", totalResults.MessagesCount + totalResults.PaidMessagesCount)
|
||||||
.ForContext("TotalMinutes", totalTime.TotalMinutes)
|
.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);
|
await Task.Delay(2000);
|
||||||
}
|
}
|
||||||
@ -322,7 +330,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 +381,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 +389,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 +418,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();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user