diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-10-27 22:29:56 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-10-27 22:29:56 +0200 |
commit | 4d4308c46d4f7801c657cc79d2243e1a81831334 (patch) | |
tree | a2e392e0af92b9a3ca3d1b5afb841640276e2294 /includes/restore.js | |
parent | 9f9d66afebc59c6c265c4424f7b8fb36d8876541 (diff) | |
download | mist-4d4308c46d4f7801c657cc79d2243e1a81831334.tar.gz mist-4d4308c46d4f7801c657cc79d2243e1a81831334.tar.bz2 mist-4d4308c46d4f7801c657cc79d2243e1a81831334.zip |
Updated 32 files, added 279 files, deleted 3 files and renamed 14 files (automated)
Diffstat (limited to 'includes/restore.js')
-rw-r--r-- | includes/restore.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/includes/restore.js b/includes/restore.js new file mode 100644 index 0000000..3edeb2a --- /dev/null +++ b/includes/restore.js @@ -0,0 +1,22 @@ +console.log("Reading archive..."); +const archive = require('../assets/content/archive.json'); +const fs = require('fs'); +const path = require('path'); + +let i = 1; + +for (let id of Object.keys(archive)) { + console.log("Restoring " + id + " to " + archive[id] + " (" + i + "/" + Object.keys(archive).length + ")"); + if (!fs.existsSync(path.dirname(archive[id]))) fs.mkdirSync(path.dirname(archive[id]), { recursive: true }); + fs.renameSync("../assets/content/" + id + ".flac", archive[id]); + i++; +} + +console.log("Cleaning up..."); +for (let file of fs.readdirSync("../assets/content")) { + if (!file.startsWith(".") && file !== "_") { + fs.rmSync("../assets/content/" + file, { recursive: true }); + } +} + +console.log("Done. Run the process.js script again to reprocess the data.");
\ No newline at end of file |