koztv-blog-tools 1.2.2 → 1.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +6 -7
- package/dist/index.mjs +6 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -731,8 +731,10 @@ async function processPost(post, options, exportDir) {
|
|
|
731
731
|
const ext = path2.extname(sourcePath).toLowerCase() || ".jpg";
|
|
732
732
|
const newName = `image${i + 1}${ext}`;
|
|
733
733
|
const targetPath = path2.join(targetMediaDir, newName);
|
|
734
|
-
if (fs2.existsSync(sourcePath)
|
|
735
|
-
fs2.
|
|
734
|
+
if (fs2.existsSync(sourcePath)) {
|
|
735
|
+
if (!fs2.existsSync(targetPath)) {
|
|
736
|
+
fs2.copyFileSync(sourcePath, targetPath);
|
|
737
|
+
}
|
|
736
738
|
mediaFiles.push(newName);
|
|
737
739
|
}
|
|
738
740
|
}
|
|
@@ -802,10 +804,6 @@ async function exportAndTranslate(options) {
|
|
|
802
804
|
let skipped = 0;
|
|
803
805
|
for (const post of exportResult.posts) {
|
|
804
806
|
const postId = `${post.channelUsername}-${post.msgId}`;
|
|
805
|
-
if (processedLog[postId]) {
|
|
806
|
-
skipped++;
|
|
807
|
-
continue;
|
|
808
|
-
}
|
|
809
807
|
if (!post.content && !post.hasMedia) {
|
|
810
808
|
skipped++;
|
|
811
809
|
continue;
|
|
@@ -816,8 +814,9 @@ Processing: ${postId}`);
|
|
|
816
814
|
const created = await processPost(post, options, exportDir);
|
|
817
815
|
if (created.length > 0) {
|
|
818
816
|
processed++;
|
|
817
|
+
const existing = processedLog[postId]?.posts || [];
|
|
819
818
|
processedLog[postId] = {
|
|
820
|
-
posts: created,
|
|
819
|
+
posts: [.../* @__PURE__ */ new Set([...existing, ...created])],
|
|
821
820
|
date: post.date.toISOString(),
|
|
822
821
|
processedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
823
822
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -674,8 +674,10 @@ async function processPost(post, options, exportDir) {
|
|
|
674
674
|
const ext = path2.extname(sourcePath).toLowerCase() || ".jpg";
|
|
675
675
|
const newName = `image${i + 1}${ext}`;
|
|
676
676
|
const targetPath = path2.join(targetMediaDir, newName);
|
|
677
|
-
if (fs2.existsSync(sourcePath)
|
|
678
|
-
fs2.
|
|
677
|
+
if (fs2.existsSync(sourcePath)) {
|
|
678
|
+
if (!fs2.existsSync(targetPath)) {
|
|
679
|
+
fs2.copyFileSync(sourcePath, targetPath);
|
|
680
|
+
}
|
|
679
681
|
mediaFiles.push(newName);
|
|
680
682
|
}
|
|
681
683
|
}
|
|
@@ -745,10 +747,6 @@ async function exportAndTranslate(options) {
|
|
|
745
747
|
let skipped = 0;
|
|
746
748
|
for (const post of exportResult.posts) {
|
|
747
749
|
const postId = `${post.channelUsername}-${post.msgId}`;
|
|
748
|
-
if (processedLog[postId]) {
|
|
749
|
-
skipped++;
|
|
750
|
-
continue;
|
|
751
|
-
}
|
|
752
750
|
if (!post.content && !post.hasMedia) {
|
|
753
751
|
skipped++;
|
|
754
752
|
continue;
|
|
@@ -759,8 +757,9 @@ Processing: ${postId}`);
|
|
|
759
757
|
const created = await processPost(post, options, exportDir);
|
|
760
758
|
if (created.length > 0) {
|
|
761
759
|
processed++;
|
|
760
|
+
const existing = processedLog[postId]?.posts || [];
|
|
762
761
|
processedLog[postId] = {
|
|
763
|
-
posts: created,
|
|
762
|
+
posts: [.../* @__PURE__ */ new Set([...existing, ...created])],
|
|
764
763
|
date: post.date.toISOString(),
|
|
765
764
|
processedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
766
765
|
};
|