let download images via ingest now
This commit is contained in:
parent
01e778edad
commit
abf3244dda
29 changed files with 3728 additions and 42 deletions
3578
util/border_data.json
Normal file
3578
util/border_data.json
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
|||
console.log("a");
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const Prisma = require("@prisma/client");
|
||||
|
||||
const prisma = new Prisma.PrismaClient();
|
||||
|
@ -9,32 +9,41 @@ console.log("processing new border images");
|
|||
|
||||
const cwd = process.cwd();
|
||||
|
||||
const folder = path.join(cwd, cwd.includes("util") ? ".." : "", "public/images");
|
||||
const folder = path.join(
|
||||
cwd,
|
||||
cwd.includes("util") ? ".." : "",
|
||||
"public/images"
|
||||
);
|
||||
const list = fs.readdirSync(folder);
|
||||
|
||||
(async () => {
|
||||
let numAdded = 0;
|
||||
for (let item of list) {
|
||||
// console.log(item);
|
||||
let numAdded = 0;
|
||||
for (let item of list) {
|
||||
// console.log(item);
|
||||
|
||||
const result = await prisma.borderImage.findFirst(
|
||||
{
|
||||
where: {
|
||||
imageName: item
|
||||
}
|
||||
}
|
||||
);
|
||||
if (!result) {
|
||||
const added = await prisma.borderImage.create(
|
||||
{
|
||||
data: {
|
||||
imageName: item
|
||||
},
|
||||
}
|
||||
);
|
||||
numAdded++;
|
||||
console.log(added);
|
||||
}
|
||||
const result = await prisma.borderImage.findFirst({
|
||||
where: {
|
||||
imageName: item,
|
||||
},
|
||||
});
|
||||
if (!result && item == "default.png") {
|
||||
const added = await prisma.borderImage.create({
|
||||
data: {
|
||||
id: 0,
|
||||
imageName: item,
|
||||
},
|
||||
});
|
||||
numAdded++;
|
||||
console.log(added);
|
||||
} else if (!result) {
|
||||
const added = await prisma.borderImage.create({
|
||||
data: {
|
||||
imageName: item,
|
||||
},
|
||||
});
|
||||
numAdded++;
|
||||
console.log(added);
|
||||
}
|
||||
console.log(`Processed ${numAdded} new images.`);
|
||||
})();
|
||||
}
|
||||
console.log(`Processed ${numAdded} new images.`);
|
||||
})();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue