🔊 Show generation time
This commit is contained in:
parent
574e4a001c
commit
9e92f3ceb8
1 changed files with 10 additions and 2 deletions
12
main.js
12
main.js
|
@ -8,12 +8,15 @@ const myGm = gm.subClass({imageMagick: true});
|
||||||
const position = {x: 4, y: 2, gravity: "NorthEast"}
|
const position = {x: 4, y: 2, gravity: "NorthEast"}
|
||||||
const metadatas = []
|
const metadatas = []
|
||||||
|
|
||||||
|
let count = 0;
|
||||||
|
const start = Date.now();
|
||||||
|
|
||||||
data.forEach(prideflag => {
|
data.forEach(prideflag => {
|
||||||
console.log(`== Creating flags for ${prideflag.name.en}`);
|
console.log(`== Creating flags for ${prideflag.name.en}`);
|
||||||
const imageMetadata = {title:`Drapeau ${prideflag.name.fr.toLowerCase()} :`, list:[]};
|
const imageMetadata = {title:`Drapeau ${prideflag.name.fr.toLowerCase()} :`, list:[]};
|
||||||
prideflag.texts.forEach(text => {
|
prideflag.texts.forEach(text => {
|
||||||
const outputfile = `${prideflag.name.en.toLowerCase()}-${text.replace("⋅", "_").replace(" ", "_").replace("\n", '-').toLowerCase()}.png`
|
const outputfile = `${prideflag.name.en.toLowerCase()}-${text.replace("⋅", "_").replace(" ", "_").replace("\n", '-').toLowerCase()}.png`
|
||||||
console.log(`Creating button for text ${text} (${outputfile})`);
|
console.log(`Creating button for text "${text.replace("\n", " ")}" (${outputfile})`);
|
||||||
const data = {file: outputfile, alt:`Drapeau ${prideflag.name.fr.toLowerCase()} avec écrit "${text.replace("\n", " ").toLowerCase()}"`};
|
const data = {file: outputfile, alt:`Drapeau ${prideflag.name.fr.toLowerCase()} avec écrit "${text.replace("\n", " ").toLowerCase()}"`};
|
||||||
imageMetadata.list.push(data);
|
imageMetadata.list.push(data);
|
||||||
const turnedText = text
|
const turnedText = text
|
||||||
|
@ -37,11 +40,16 @@ data.forEach(prideflag => {
|
||||||
throw err;
|
throw err;
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
count++;
|
||||||
})
|
})
|
||||||
metadatas.push(imageMetadata);
|
metadatas.push(imageMetadata);
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(metadatas);
|
const millis = Date.now() - start;
|
||||||
|
console.log("");
|
||||||
|
console.log("-----------------------")
|
||||||
|
console.log(`Generation finished in ${millis / 1000}s`);
|
||||||
|
console.log(`${count} files generated`);
|
||||||
|
|
||||||
fs.writeFile("./output/pridebuttons.json", JSON.stringify(metadatas), (err) => {
|
fs.writeFile("./output/pridebuttons.json", JSON.stringify(metadatas), (err) => {
|
||||||
if (err) {
|
if (err) {
|
||||||
|
|
Loading…
Reference in a new issue