added unready collecting script
This commit is contained in:
31
scripts/unready.ts
Normal file
31
scripts/unready.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import fs from "node:fs";
|
||||
|
||||
const CHAPTERS = JSON.parse(fs.readFileSync("./data.json", "utf-8"));
|
||||
|
||||
for (const chapter of Object.keys(CHAPTERS)) {
|
||||
const OriginalPath = `../_sprites/original/${chapter}`;
|
||||
const UnreadyPath = `../_sprites/unready`;
|
||||
|
||||
if (!fs.existsSync(UnreadyPath)) fs.mkdirSync(UnreadyPath);
|
||||
|
||||
fs.cpSync(OriginalPath, UnreadyPath, { recursive: true, force: true });
|
||||
}
|
||||
|
||||
const TRANSLATED = fs.readdirSync("../_sprites/translation");
|
||||
const UNREADY = fs.readdirSync("../_sprites/unready");
|
||||
|
||||
for (const sprite of TRANSLATED) {
|
||||
if (sprite.endsWith(".png")) {
|
||||
if (UNREADY.includes(sprite)) fs.rmSync(`../_sprites/unready/${sprite}`);
|
||||
} else {
|
||||
if (
|
||||
fs.existsSync(`../_sprites/unready/${sprite}`) &&
|
||||
fs.readdirSync(`../_sprites/unready/${sprite}`).length ==
|
||||
fs.readdirSync(`../_sprites/translation/${sprite}`).length
|
||||
)
|
||||
fs.rmSync(`../_sprites/unready/${sprite}`, {
|
||||
recursive: true,
|
||||
force: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user