Merge branch 'claude/friendly-bhaskara-b06186' into master

This commit is contained in:
jim committed 2026-10-02 09:26:26 -05:00
commit bde6506e01
1 file changed
+25 -17
+25 -17
View File
@@ -1592,17 +1592,15 @@ if (shouldInsert)
var urls = new List<string>(); var urls = new List<string>();
var reblog = new ReblogRecord(); var reblog = new ReblogRecord();
string[] fileLines = File.ReadAllLines(file); // A record without downloaded files is only complete once the next
for (int lineIndex = 0; lineIndex < fileLines.Length; lineIndex++) // "Post id:" line (or end of file) is reached, so it is imported then.
void ImportRecordWithoutDownloadedFiles(ReblogRecord record, ref int added)
{ {
string line = fileLines[lineIndex]; if (record.reblogName != "." && record.postID != "." && record.date != "." && record.reblogURL != "." && record.downloadedFiles == ".")
if (line.StartsWith("Post id:", StringComparison.OrdinalIgnoreCase))
{ {
if (reblog.reblogName != "." && reblog.postID != "." && reblog.date != "." && reblog.reblogURL != "." && reblog.downloadedFiles == ".") if (!record.reblogURL.Contains("deactivated")
{ && record.reblogURL.Length != 0
if (!reblog.reblogURL.Contains("deactivated") && ContainsAny(record.reblogURL, contains))
&& reblog.reblogURL.Length != 0
&& ContainsAny(reblog.reblogURL, contains))
{ {
DirectoryInfo currentDir = new DirectoryInfo(path); DirectoryInfo currentDir = new DirectoryInfo(path);
if (!headerWasWritten) if (!headerWasWritten)
@@ -1610,24 +1608,33 @@ if (shouldInsert)
headerWasWritten = true; headerWasWritten = true;
} }
string curDir = NormalizeBlogFolderName(currentDir.Name); string curDir = NormalizeBlogFolderName(currentDir.Name);
urls.Add(string.Format("{0}\t{1}", curDir, reblog.postID)); urls.Add(string.Format("{0}\t{1}", curDir, record.postID));
var recordImportStopwatch = System.Diagnostics.Stopwatch.StartNew(); var recordImportStopwatch = System.Diagnostics.Stopwatch.StartNew();
DataAccess.AddPost(curDir, long.Parse(reblog.postID), reblog.reblogURL, reblog.date, reblog.postURL, reblog.slug, reblog.reblogKey, DataAccess.AddPost(curDir, long.Parse(record.postID), record.reblogURL, record.date, record.postURL, record.slug, record.reblogKey,
reblog.reblogName, reblog.summary, reblog.quote, reblog.body, reblog.tags, reblog.link, reblog.photoURL, record.reblogName, record.summary, record.quote, record.body, record.tags, record.link, record.photoURL,
reblog.photoCaption, reblog.downloadedFiles, reblog.audioCaption, reblog.question, reblog.answer, record.photoCaption, record.downloadedFiles, record.audioCaption, record.question, record.answer,
reblog.title, false, rootURL: reblog.rootURL, postType: filePostType); record.title, false, rootURL: record.rootURL, postType: filePostType);
recordImportStopwatch.Stop(); recordImportStopwatch.Stop();
postsAdded++; added++;
directoryRecordsImported++; directoryRecordsImported++;
if (logRecordImports) if (logRecordImports)
Console.WriteLine($"[Record Import] {curDir}/{reblog.postID} | {recordImportStopwatch.Elapsed.TotalMilliseconds:F2} ms | DirectoryCount={directoryRecordsImported} | TotalCount={postsAdded}"); Console.WriteLine($"[Record Import] {curDir}/{record.postID} | {recordImportStopwatch.Elapsed.TotalMilliseconds:F2} ms | DirectoryCount={directoryRecordsImported} | TotalCount={added}");
// Output hyperlink and post date // Output hyperlink and post date
//Console.WriteLine($"https://{reblog.reblogName}.tumblr.com/post/{reblog.postID} - {reblog.date}"); //Console.WriteLine($"https://{record.reblogName}.tumblr.com/post/{record.postID} - {record.date}");
} }
} }
}
string[] fileLines = File.ReadAllLines(file);
for (int lineIndex = 0; lineIndex < fileLines.Length; lineIndex++)
{
string line = fileLines[lineIndex];
if (line.StartsWith("Post id:", StringComparison.OrdinalIgnoreCase))
{
ImportRecordWithoutDownloadedFiles(reblog, ref postsAdded);
reblog = new ReblogRecord(); reblog = new ReblogRecord();
reblog.postID = line.Substring(9).Trim(); reblog.postID = line.Substring(9).Trim();
} }
@@ -1777,6 +1784,7 @@ if (shouldInsert)
} }
} }
} }
ImportRecordWithoutDownloadedFiles(reblog, ref postsAdded);
urls.Sort(); urls.Sort();