feat(likes): accept multiple blog names with --likes
Change --likes from accepting a single blog name to accepting a list. Passes all non-flag args after --likes as blog names. Database stores bare blog names, so users pass just the name without .tumblr.com. Co-Authored-By: Claude <[email protected]>
This commit is contained in:
1 parent
ca99586176
commit
7557c9a168
2 files changed
+22
-16
No files matched your search
@@ -415,9 +415,15 @@ namespace URLNotesGrabberCORE
|
||||
break;
|
||||
|
||||
case "--likes":
|
||||
string likeBlog = args.Length > 1 ? args[1] : null;
|
||||
List<string> likeBlogs = new List<string>();
|
||||
for (int j = 1; j < args.Length; j++)
|
||||
{
|
||||
string arg = args[j];
|
||||
if (arg.StartsWith("--")) break; // stop at next flag
|
||||
likeBlogs.Add(arg);
|
||||
}
|
||||
int cooldownDays = settings.GetValue("LikesRefreshCooldownDays", 7);
|
||||
CollectLikes(likeBlog, contains, cooldownDays, forceIgnoreCooldown).GetAwaiter().GetResult();
|
||||
CollectLikes(likeBlogs, contains, cooldownDays, forceIgnoreCooldown).GetAwaiter().GetResult();
|
||||
break;
|
||||
|
||||
case "--urldump":
|
||||
@@ -509,7 +515,7 @@ namespace URLNotesGrabberCORE
|
||||
|
||||
Console.WriteLine("--replies\t Fetch and update missing reply text for all replies in database");
|
||||
|
||||
Console.WriteLine("--likes\t Fetch likes: initial backfill for new blogs, incremental refresh for blogs past cooldown. Optional blog name forces single-blog run.");
|
||||
Console.WriteLine("--likes [blog1 [blog2 ...]]\t Fetch likes: initial backfill for new blogs, incremental refresh for blogs past cooldown. One or more blog names restricts to those blogs.");
|
||||
|
||||
Console.WriteLine("--force\t Ignore refresh cooldowns: with --likes, refresh every fully-backfilled blog; with --collect 1, re-queue already-collected posts without waiting out their cooldown");
|
||||
|
||||
@@ -913,14 +919,14 @@ namespace URLNotesGrabberCORE
|
||||
}
|
||||
}
|
||||
|
||||
static async Task CollectLikes(string specificBlog, List<string> contains, int cooldownDays = 7, bool ignoreCooldown = false)
|
||||
static async Task CollectLikes(List<string> specificBlogs, List<string> contains, int cooldownDays = 7, bool ignoreCooldown = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
DataAccess.EnsureBlogsLikesColumnsExist();
|
||||
|
||||
Console.WriteLine($"Starting collection of likes... (cooldown {cooldownDays}d, ignoreCooldown={ignoreCooldown})");
|
||||
var blogsToProcess = DataAccess.GetBlogsForLikes(specificBlog, cooldownDays, ignoreCooldown);
|
||||
var blogsToProcess = DataAccess.GetBlogsForLikes(specificBlogs, cooldownDays, ignoreCooldown);
|
||||
|
||||
if (blogsToProcess.Count == 0)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user