Added total new media counts context to "Scrape Completed" log

This commit is contained in:
Casper Sparre 2025-10-22 00:59:01 +02:00
parent d0bbf051e3
commit 0ed02a9316

View File

@ -1458,6 +1458,15 @@ public class Program
} }
else if (hasSelectedUsersKVP.Key && !hasSelectedUsersKVP.Value.ContainsKey("ConfigChanged")) else if (hasSelectedUsersKVP.Key && !hasSelectedUsersKVP.Value.ContainsKey("ConfigChanged"))
{ {
int totalNewPaidPostCount = 0;
int totalNewPostCount = 0;
int totalNewArchivedCount = 0;
int totalNewStreamsCount = 0;
int totalNewStoriesCount = 0;
int totalNewHighlightsCount = 0;
int totalNewMessagesCount = 0;
int totalNewPaidMessagesCount = 0;
//Iterate over each user in the list of users //Iterate over each user in the list of users
int userNum = 0; int userNum = 0;
int userCount = hasSelectedUsersKVP.Value.Count; int userCount = hasSelectedUsersKVP.Value.Count;
@ -1528,41 +1537,49 @@ public class Program
if (Config.DownloadPaidPosts) if (Config.DownloadPaidPosts)
{ {
(paidPostCount, newPaidPostCount) = await DownloadPaidPosts(downloadContext, hasSelectedUsersKVP, user, paidPostCount, path); (paidPostCount, newPaidPostCount) = await DownloadPaidPosts(downloadContext, hasSelectedUsersKVP, user, paidPostCount, path);
totalNewPaidPostCount += newPaidPostCount;
} }
if (Config.DownloadPosts) if (Config.DownloadPosts)
{ {
(postCount, newPostCount) = await DownloadFreePosts(downloadContext, hasSelectedUsersKVP, user, postCount, path); (postCount, newPostCount) = await DownloadFreePosts(downloadContext, hasSelectedUsersKVP, user, postCount, path);
totalNewPostCount += newPostCount;
} }
if (Config.DownloadArchived) if (Config.DownloadArchived)
{ {
(archivedCount, newArchivedCount) = await DownloadArchived(downloadContext, hasSelectedUsersKVP, user, archivedCount, path); (archivedCount, newArchivedCount) = await DownloadArchived(downloadContext, hasSelectedUsersKVP, user, archivedCount, path);
totalNewArchivedCount += newArchivedCount;
} }
if (Config.DownloadStreams) if (Config.DownloadStreams)
{ {
(streamsCount, newStreamsCount) = await DownloadStreams(downloadContext, hasSelectedUsersKVP, user, streamsCount, path); (streamsCount, newStreamsCount) = await DownloadStreams(downloadContext, hasSelectedUsersKVP, user, streamsCount, path);
totalNewStreamsCount += newStreamsCount;
} }
if (Config.DownloadStories) if (Config.DownloadStories)
{ {
(storiesCount, newStoriesCount) = await DownloadStories(downloadContext, user, storiesCount, path); (storiesCount, newStoriesCount) = await DownloadStories(downloadContext, user, storiesCount, path);
totalNewStoriesCount += newStoriesCount;
} }
if (Config.DownloadHighlights) if (Config.DownloadHighlights)
{ {
(highlightsCount, newHighlightsCount) = await DownloadHighlights(downloadContext, user, highlightsCount, path); (highlightsCount, newHighlightsCount) = await DownloadHighlights(downloadContext, user, highlightsCount, path);
totalNewHighlightsCount += newHighlightsCount;
} }
if (Config.DownloadMessages) if (Config.DownloadMessages)
{ {
(messagesCount, newMessagesCount) = await DownloadMessages(downloadContext, hasSelectedUsersKVP, user, messagesCount, path); (messagesCount, newMessagesCount) = await DownloadMessages(downloadContext, hasSelectedUsersKVP, user, messagesCount, path);
totalNewMessagesCount += newMessagesCount;
} }
if (Config.DownloadPaidMessages) if (Config.DownloadPaidMessages)
{ {
(paidMessagesCount, newPaidMessagesCount) = await DownloadPaidMessages(downloadContext, hasSelectedUsersKVP, user, paidMessagesCount, path); (paidMessagesCount, newPaidMessagesCount) = await DownloadPaidMessages(downloadContext, hasSelectedUsersKVP, user, paidMessagesCount, path);
totalNewPaidMessagesCount += newPaidMessagesCount;
} }
AnsiConsole.Markup("\n"); AnsiConsole.Markup("\n");
@ -1594,7 +1611,15 @@ public class Program
DateTime endTime = DateTime.Now; DateTime endTime = DateTime.Now;
TimeSpan totalTime = endTime - startTime; TimeSpan totalTime = endTime - startTime;
Log.Information("Scrape Completed in {TotalMinutes:0.00} minutes", totalTime.TotalMinutes); Log.ForContext("Paid Posts", totalNewPaidPostCount)
.ForContext("Posts", totalNewPostCount)
.ForContext("Archived", totalNewArchivedCount)
.ForContext("Streams", totalNewStreamsCount)
.ForContext("Stories", totalNewStoriesCount)
.ForContext("Highlights", totalNewHighlightsCount)
.ForContext("Messages", totalNewMessagesCount)
.ForContext("Paid Messages", totalNewPaidMessagesCount)
.Information("Scrape Completed in {TotalMinutes:0.00} minutes", totalTime.TotalMinutes);
AnsiConsole.Markup($"[green]Scrape Completed in {totalTime.TotalMinutes:0.00} minutes\n[/]"); AnsiConsole.Markup($"[green]Scrape Completed in {totalTime.TotalMinutes:0.00} minutes\n[/]");
} }
else if (hasSelectedUsersKVP.Key && hasSelectedUsersKVP.Value != null && hasSelectedUsersKVP.Value.ContainsKey("ConfigChanged")) else if (hasSelectedUsersKVP.Key && hasSelectedUsersKVP.Value != null && hasSelectedUsersKVP.Value.ContainsKey("ConfigChanged"))