diff --git a/URLNotesGrabberCORE/Program.cs b/URLNotesGrabberCORE/Program.cs index b90de42..71a1b58 100644 --- a/URLNotesGrabberCORE/Program.cs +++ b/URLNotesGrabberCORE/Program.cs @@ -563,10 +563,12 @@ namespace URLNotesGrabberCORE Console.WriteLine(); int totalProcessedCount = 0; - int successCount = 0; + int totalReplies = DataAccess.GetRepliesWithFilledText()?.Count ?? 0; - // Get posts with missing reply text - while (true) + Console.WriteLine($"[Reply Text] Total replies to process: {totalReplies}"); + Console.WriteLine(); + + while (totalProcessedCount < totalReplies) { var batch = DataAccess.GetRepliesWithFilledText(); @@ -576,27 +578,31 @@ namespace URLNotesGrabberCORE break; } - Console.WriteLine($"[Reply Text] Found {batch.Count} replies to process"); - foreach (var reply in batch) { var blogName = (reply as Tuple).Item1; var postID = (reply as Tuple).Item2; var timestamp = (reply as Tuple).Item3; - Console.WriteLine($"[Reply Text] Processing {blogName}/{postID}/{timestamp}"); - await FetchAndStoreReplyText(blogName, postID, timestamp); totalProcessedCount++; - - if (totalProcessedCount % 10 == 0) + + int remaining = totalReplies - totalProcessedCount; + double completionPct = (totalProcessedCount / (double)totalReplies) * 100.0; + + var previousColor = Console.ForegroundColor; + Console.ForegroundColor = ConsoleColor.Cyan; + Console.WriteLine($"[{remaining} remaining] [{totalProcessedCount}/{totalReplies}] ({completionPct:F1}%)"); + Console.ForegroundColor = previousColor; + + if (totalProcessedCount % 50 == 0 && totalProcessedCount < totalReplies) { await Task.Delay(2000); } } } - Console.WriteLine($"[Reply Text] Completed. Total processed: {totalProcessedCount} posts."); + Console.WriteLine($"[Reply Text] Complete. Total processed: {totalProcessedCount} replies."); } catch (Exception ex) {