feat: add [X remaining] progress counter to likes mode output
This commit is contained in:
@@ -769,8 +769,9 @@ namespace URLNotesGrabberCORE
|
||||
AutoReplenishment = true
|
||||
});
|
||||
|
||||
foreach (var blogInfo in blogsToProcess)
|
||||
foreach (int i, var blogInfo in blogsToProcess)
|
||||
{
|
||||
int remaining = blogsToProcess.Count - i - 1;
|
||||
string blogName = blogInfo.Item1;
|
||||
int likesPulled = blogInfo.Item2;
|
||||
long cursor = blogInfo.Item3;
|
||||
@@ -788,7 +789,7 @@ namespace URLNotesGrabberCORE
|
||||
if (isRefresh) cursor = 0;
|
||||
|
||||
string mode = isRefresh ? "REFRESH" : "BACKFILL";
|
||||
Console.WriteLine($"Processing likes for blog: {blogName} | Mode: {mode} | Cursor: {cursor} | HighWaterMark: {storedNewestTs}");
|
||||
Console.WriteLine($"[{remaining} remaining] Processing likes for blog: {blogName} | Mode: {mode} | Cursor: {cursor} | HighWaterMark: {storedNewestTs}");
|
||||
|
||||
bool hasMoreLikes = true;
|
||||
bool isFirstPage = true;
|
||||
@@ -844,7 +845,7 @@ namespace URLNotesGrabberCORE
|
||||
if (response.response.liked_count > 0)
|
||||
likedCountForBlog = response.response.liked_count;
|
||||
|
||||
Console.WriteLine($"[Likes] Fetched {response.response.liked_posts.Count} likes for {blogName}");
|
||||
Console.WriteLine($"[Likes] [Fetched {response.response.liked_posts.Count}] {blogName}");
|
||||
|
||||
bool crossedHighWaterMark = false;
|
||||
|
||||
@@ -957,16 +958,16 @@ namespace URLNotesGrabberCORE
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldInsert)
|
||||
{
|
||||
if (shouldInsert)
|
||||
{
|
||||
matchedForBlog++;
|
||||
if (isRefresh) newInsertedInRefresh++;
|
||||
Console.WriteLine($"[Likes] Match | Author: {authorBlog} | PostID: {postID} | Field: {matchedFieldName}");
|
||||
Console.WriteLine($"[Likes] [Matched] {blogName} | Author: {authorBlog} | PostID: {postID} | Field: {matchedFieldName}");
|
||||
await Task.Delay(3000);
|
||||
DataAccess.AddPost(authorBlog, postID, reblogURL, date, postURL, slug, reblogKey,
|
||||
reblogName, summary, quote, body, tags, link, photoURL,
|
||||
photoCaption, downloadedFiles, audioCaption, question, answer,
|
||||
title, hasImage, true, rootBlogName: rootBlogName, rootURL: rootURL);
|
||||
reblogName, summary, quote, body, tags, link, photoURL,
|
||||
photoCaption, downloadedFiles, audioCaption, question, answer,
|
||||
title, hasImage, true, rootBlogName: rootBlogName, rootURL: rootURL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1023,6 +1024,7 @@ namespace URLNotesGrabberCORE
|
||||
hasMoreLikes = false;
|
||||
}
|
||||
|
||||
Console.WriteLine($"[{remaining} remaining] Done with {blogName}");
|
||||
await Task.Delay(1000); // 1-second delay between pages
|
||||
}
|
||||
|
||||
@@ -1031,7 +1033,7 @@ namespace URLNotesGrabberCORE
|
||||
WriteLikesTotalsLine(blogName, "Final Totals", parsedForBlog, matchedForBlog, likedCountForBlog);
|
||||
}
|
||||
|
||||
Console.WriteLine("Likes collection complete.");
|
||||
Console.WriteLine("[Likes] [Likes collection complete]");
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user