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 3855a5e862
commit cf1564bc7f

View File

@ -1389,6 +1389,15 @@ public class Program
}
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
int userNum = 0;
int userCount = hasSelectedUsersKVP.Value.Count;
@ -1459,41 +1468,49 @@ public class Program
if (Config.DownloadPaidPosts)
{
(paidPostCount, newPaidPostCount) = await DownloadPaidPosts(downloadContext, hasSelectedUsersKVP, user, paidPostCount, path);
totalNewPaidPostCount += newPaidPostCount;
}
if (Config.DownloadPosts)
{
(postCount, newPostCount) = await DownloadFreePosts(downloadContext, hasSelectedUsersKVP, user, postCount, path);
totalNewPostCount += newPostCount;
}
if (Config.DownloadArchived)
{
(archivedCount, newArchivedCount) = await DownloadArchived(downloadContext, hasSelectedUsersKVP, user, archivedCount, path);
totalNewArchivedCount += newArchivedCount;
}
if (Config.DownloadStreams)
{
(streamsCount, newStreamsCount) = await DownloadStreams(downloadContext, hasSelectedUsersKVP, user, streamsCount, path);
totalNewStreamsCount += newStreamsCount;
}
if (Config.DownloadStories)
{
(storiesCount, newStoriesCount) = await DownloadStories(downloadContext, user, storiesCount, path);
totalNewStoriesCount += newStoriesCount;
}
if (Config.DownloadHighlights)
{
(highlightsCount, newHighlightsCount) = await DownloadHighlights(downloadContext, user, highlightsCount, path);
totalNewHighlightsCount += newHighlightsCount;
}
if (Config.DownloadMessages)
{
(messagesCount, newMessagesCount) = await DownloadMessages(downloadContext, hasSelectedUsersKVP, user, messagesCount, path);
totalNewMessagesCount += newMessagesCount;
}
if (Config.DownloadPaidMessages)
{
(paidMessagesCount, newPaidMessagesCount) = await DownloadPaidMessages(downloadContext, hasSelectedUsersKVP, user, paidMessagesCount, path);
totalNewPaidMessagesCount += newPaidMessagesCount;
}
AnsiConsole.Markup("\n");
@ -1525,7 +1542,15 @@ public class Program
DateTime endTime = DateTime.Now;
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[/]");
}
else if (hasSelectedUsersKVP.Key && hasSelectedUsersKVP.Value != null && hasSelectedUsersKVP.Value.ContainsKey("ConfigChanged"))