src/gen-successed-excel.mjs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/main.mjs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
src/parse-log.mjs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
src/gen-successed-excel.mjs
New file @@ -0,0 +1,29 @@ import * as fs from 'fs'; import xlsx from "node-xlsx"; async function main() { const dir = ''; const files = fs.readdirSync(dir); const books = []; const bookMap = {}; const workSheets = xlsx.parse("【第二批二次处理后】交付清单.xlsx"); const sheet = workSheets[0]; const data = sheet.data; data[0][12] = '文件名'; data[0][13] = '状态'; for (const file of files) { const ext = file.substring(file.lastIndexOf('.') + 1); const name = file.substring(0, file.lastIndexOf('.')); const [id, title] = name.split(' '); bookMap[name] = { id, title, file }; } for (const book of data.slice(1)) { const _id = book[0] + ' ' + book[1]; const bookInfo = bookMap[_id]; if (bookInfo) { book[12] = bookInfo.file; book[13] = '以提供'; } } } src/main.mjs
@@ -4,7 +4,6 @@ import path from "path"; import { Worker, isMainThread, parentPort, workerData, threadId } from 'worker_threads'; import { HttpsProxyAgent } from "https-proxy-agent"; import { resolve } from "path"; import { execFileSync } from "child_process"; import wordsjs from 'wordlist-js'; import usPlaceList from "./us-place-list.mjs"; src/parse-log.mjs
@@ -82,4 +82,7 @@ const noFileBooks = books.filter(book => !book.download && !book.downloadUrl).map(book => book.bookId).join('\n'); fs.writeFileSync('./no-file-books.txt', noFileBooks); const successBooks = books.filter(book => book.download).map(book => book.bookId).join('\n'); fs.writeFileSync('./success-books.txt', successBooks); }