feat: merge ThreeTxtFileHelper into URLNotesGrabberCORE
Folds the standalone ThreeTxtFileHelper tool into URLNotesGrabberCORE so text-file ingest/output/correct lives alongside the API scraper. Adds new flags -ingest, -output, -correct (with -apply), -updatepaths, and a one-time -importposts <posts.db> migration. Schema: Blogs.TTFolderPath and Posts.PostType are added by an idempotent migration. On (BlogName, PostID) collisions, content columns are overwritten while engagement columns (ByLikes, RootBlogName, RootURL, HasNotesGathered, NotFound, NotesGatheredDateTime, Likes*) are preserved. Co-Authored-By: Claude Opus 4.7 <[email protected]>
This commit is contained in:
@@ -181,6 +181,18 @@ namespace URLNotesGrabberCORE
|
||||
|
||||
Console.WriteLine("-api [section]\t Use a specific API settings section from appsettings.json (e.g. TumblrApi3)");
|
||||
|
||||
Console.WriteLine("-ingest [path]\t Ingest Tumblr .txt exports under path (or appSettings:PathTTRoot) into TL.db");
|
||||
|
||||
Console.WriteLine("-output\t Export posts from TL.db back to .txt files in each blog's TTFolderPath");
|
||||
|
||||
Console.WriteLine("-correct [bakPath]\t Dry-run: report multi-line field updates available from a BAK directory");
|
||||
|
||||
Console.WriteLine("-correct -apply [bakPath]\t Apply BAK-file corrections to matching posts (prompts yes/no)");
|
||||
|
||||
Console.WriteLine("-updatepaths [rootPath]\t Read .tumblr/.tmblrpriv metadata from <root>\\Index and set Blogs.TTFolderPath");
|
||||
|
||||
Console.WriteLine("-importposts [path-to-posts.db]\t One-time migration: copy legacy ThreeTxtFileHelper posts.db rows into TL.db");
|
||||
|
||||
break;
|
||||
|
||||
case "-parse":
|
||||
@@ -309,6 +321,42 @@ namespace URLNotesGrabberCORE
|
||||
DumpUrls(settings.GetValue<string>("PathOutputUrls"));
|
||||
break;
|
||||
|
||||
case "-ingest":
|
||||
IngestMode.Run(config, args.Skip(1).ToArray());
|
||||
break;
|
||||
|
||||
case "-output":
|
||||
OutputMode.Run(config);
|
||||
break;
|
||||
|
||||
case "-correct":
|
||||
{
|
||||
bool applyChanges = args.Skip(1).Any(a => string.Equals(a, "-apply", StringComparison.OrdinalIgnoreCase) || string.Equals(a, "--apply", StringComparison.OrdinalIgnoreCase));
|
||||
var correctArgs = args.Skip(1)
|
||||
.Where(a => !string.Equals(a, "-apply", StringComparison.OrdinalIgnoreCase) && !string.Equals(a, "--apply", StringComparison.OrdinalIgnoreCase))
|
||||
.ToArray();
|
||||
CorrectMode.Run(config, correctArgs, applyChanges);
|
||||
break;
|
||||
}
|
||||
|
||||
case "-updatepaths":
|
||||
{
|
||||
string rootPath = args.Length > 1 ? args[1] : (settings.GetValue<string>("PathTTRoot") ?? settings.GetValue<string>("PathInput") ?? string.Empty);
|
||||
UpdateBlogPathsRunner.Run(rootPath);
|
||||
break;
|
||||
}
|
||||
|
||||
case "-importposts":
|
||||
{
|
||||
if (args.Length < 2)
|
||||
{
|
||||
Console.WriteLine("Usage: -importposts <path-to-legacy-posts.db>");
|
||||
break;
|
||||
}
|
||||
LegacyPostsDbImporter.Run(args[1]);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
Console.WriteLine("** Unknown Command ** " + args[0]);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user