diff options
Diffstat (limited to 'includes/external/photo')
-rw-r--r-- | includes/external/photo/5-2.png | bin | 6935 -> 0 bytes | |||
-rw-r--r-- | includes/external/photo/5.png | bin | 6000 -> 0 bytes | |||
-rw-r--r-- | includes/external/photo/canvas.png | bin | 363 -> 0 bytes | |||
-rw-r--r-- | includes/external/photo/index.js | 162 | ||||
-rw-r--r-- | includes/external/photo/output.png | bin | 64235 -> 0 bytes | |||
-rw-r--r-- | includes/external/photo/run.sh | 3 | ||||
-rw-r--r-- | includes/external/photo/temp.png | bin | 2079 -> 0 bytes |
7 files changed, 0 insertions, 165 deletions
diff --git a/includes/external/photo/5-2.png b/includes/external/photo/5-2.png Binary files differdeleted file mode 100644 index 5319d67..0000000 --- a/includes/external/photo/5-2.png +++ /dev/null diff --git a/includes/external/photo/5.png b/includes/external/photo/5.png Binary files differdeleted file mode 100644 index bc6d8d8..0000000 --- a/includes/external/photo/5.png +++ /dev/null diff --git a/includes/external/photo/canvas.png b/includes/external/photo/canvas.png Binary files differdeleted file mode 100644 index a6e5e8f..0000000 --- a/includes/external/photo/canvas.png +++ /dev/null diff --git a/includes/external/photo/index.js b/includes/external/photo/index.js deleted file mode 100644 index fda0163..0000000 --- a/includes/external/photo/index.js +++ /dev/null @@ -1,162 +0,0 @@ -const fs = require('fs'); -const cp = require('child_process'); -const child_process = require("child_process"); -const number = require('../../app.json')['signal']['raindrops']; - -let bottom = [ - "jybgq", - "auvwc", - "mvaws", - "wnujv" -]; - -let ponies = [...require('../../data/gdapd/members.json').filter(i => { - return fs.existsSync("../../data/metadata/" + i.id + ".json") && !require("../../data/metadata/" + i.id + ".json").species.includes("human"); -}), ...require('../../data/ynmuc/members.json').filter(i => { - return fs.existsSync("../../data/metadata/" + i.id + ".json") && !require("../../data/metadata/" + i.id + ".json").species.includes("human"); -})]; -let columns = Math.ceil(Math.sqrt(ponies.length)); -console.log(ponies.length + " ponies, so the image will contain " + columns + "x" + columns + " ponies"); - -let list = []; - -for (let pony of ponies) { - if (list.includes(pony.name) || bottom.includes(pony.id)) continue; - - let metadata = require("../../data/metadata/" + pony.id + ".json"); - let relations = [...(metadata.marefriends ?? []), ...(metadata.sisters ?? []), ...(metadata.caretakers ?? [])] - - list.push(pony.name); - - for (let relation of relations) { - let relationPony = ponies.filter(i => i.id === relation.split("/")[1])[0] ?? null; - if (relationPony) { - if (!list.includes(relationPony.name) && !bottom.includes(pony.id)) list.push(relationPony.name); - } - } -} - -for (let id of bottom) { - let pony = ponies.filter(i => i.id === id)[0] ?? null; - if (list.includes(pony.name)) continue; - - let metadata = require("../../data/metadata/" + pony.id + ".json"); - let relations = [...(metadata.marefriends ?? []), ...(metadata.sisters ?? []), ...(metadata.caretakers ?? [])] - - list.push(pony.name); - - for (let relation of relations) { - let relationPony = ponies.filter(i => i.id === relation.split("/")[1])[0] ?? null; - if (relationPony) { - if (!list.includes(relationPony.name)) list.push(relationPony.name); - } - } -} - -let lines = []; -while (list.length > 0) lines.push(list.splice(0, columns)); - -if (fs.existsSync("./output.png")) fs.unlinkSync("./output.png"); - -for (let index1 in lines) { - process.stdout.write(index1 + ": "); - index1 = parseInt(index1); - let line = lines[index1]; - - let toRemove; - - for (let index2 in line) { - index2 = parseInt(index2); - let cell = line[index2]; - - let pony = ponies.filter(i => i.name === cell)[0] ?? null; - process.stdout.write(pony.id); - if (pony) { - if (fs.existsSync("../../../assets/ponies/" + pony.id + ".png")) { - if (!fs.existsSync("./" + index1 + ".png")) { - cp.execFileSync("convert", ["../../../assets/ponies/" + pony.id + ".png", "-filter", "Point", "-resize", "x240", "./" + index1 + ".png"]); - process.stdout.write("..."); - - toRemove = parseInt(cp.execFileSync("identify", ["-format", "%w", "./" + index1 + ".png"]).toString()) / 2; - process.stdout.write("..."); - } else { - let width1 = (index2 + 1) * 240; - let width2 = index2 * 120; - - cp.execFileSync("convert", ["../../../assets/ponies/" + pony.id + ".png", "-filter", "Point", "-resize", "x240", "./temp.png"]); - process.stdout.write("."); - cp.execFileSync("convert", ["-size", width1 + "x240", "xc:transparent", "canvas.png"]); - process.stdout.write("."); - cp.execFileSync("convert", ["canvas.png", "-colorspace", "sRGB", "./temp.png", "-geometry", "+" + width2 + "+0", "-composite", "./temp.png"]); - process.stdout.write("."); - cp.execFileSync("convert", ["./" + index1 + ".png", "-background", "none", "-extent", width1 + "x240", "./" + index1 + "-2.png"]); - process.stdout.write("."); - cp.execFileSync("convert", ["./" + index1 + "-2.png", "./temp.png", "-background", "none", "-flatten", "-trim", "+repage", "./" + index1 + "-3.png"]); - process.stdout.write("."); - - fs.unlinkSync("./" + index1 + "-2.png"); - fs.unlinkSync("./" + index1 + ".png"); - fs.renameSync("./" + index1 + "-3.png", "./" + index1 + ".png"); - process.stdout.write("."); - } - - process.stdout.write(", "); - } - } - } - - if (!fs.existsSync("./output.png")) { - cp.execFileSync("convert", ["./" + index1 + ".png", "./output.png"]); - process.stdout.write("...."); - fs.unlinkSync("./" + index1 + ".png"); - process.stdout.write("..."); - } else { - let height1 = (index1 + 1) * 480; - let height2 = index1 * 120; - - cp.execFileSync("convert", ["./" + index1 + ".png", "-filter", "Point", "-resize", "x240", "./temp.png"]); - process.stdout.write("."); - cp.execFileSync("convert", ["-size", (columns * 240) + "x" + height1, "xc:transparent", "canvas.png"]); - process.stdout.write("."); - - cp.execFileSync("convert", ["canvas.png", "-colorspace", "sRGB", "./temp.png", "-geometry", "+0+" + height2, "-composite", "./temp.png"]); - process.stdout.write("."); - cp.execFileSync("convert", ["./output.png", "-background", "none", "-extent", (columns * 240) + "x" + height1, "./output-2.png"]); - process.stdout.write("."); - cp.execFileSync("convert", ["./output-2.png", "./temp.png", "-background", "none", "-gravity", "Center", "-flatten", "-trim", "+repage", "./output-3.png"]); - process.stdout.write("."); - - fs.unlinkSync("./output-2.png"); - fs.unlinkSync("./output.png"); - fs.unlinkSync("./temp.png"); - fs.unlinkSync("./" + index1 + ".png"); - fs.unlinkSync("./canvas.png"); - process.stdout.write("."); - - fs.renameSync("./output-3.png", "./output.png"); - process.stdout.write("."); - } - - process.stdout.write("\n"); -} - - -process.stdout.write("."); -let dimensions = cp.execFileSync("identify", ["-format", "%wx%h", "./output.png"]).toString(); -process.stdout.write("."); -let highest = Math.max(...dimensions.split("x").map(i => parseInt(i))) + 200; -cp.execFileSync("convert", ["./output.png", "-background", "none", "-gravity", "Center", "-extent", highest + "x" + highest, "./output-2.png"]); -process.stdout.write("."); -cp.execFileSync("magick", ["-size", highest + "x" + highest, "-define", "gradient:direction=North", "gradient:#6acc28-#72ace5", "-colorspace", "sRGB", "gradient.png"]); -process.stdout.write("."); -cp.execFileSync("convert", ["./gradient.png", "./output-2.png", "-colorspace", "sRGB", "-flatten", "./output.png"]); -process.stdout.write("."); -fs.unlinkSync("gradient.png"); -fs.unlinkSync("output-2.png"); -process.stdout.write("."); -child_process.execFileSync("signal-cli", [ "-a", number, "updateGroup", "--group", "Im1iOlG3TxtiwAad+aVPJ6RsdSN3YCQauz1SmYiMqA8=", "--avatar", __dirname + "/output.png" ]); -process.stdout.write("."); -child_process.execFileSync("signal-cli", [ "-a", number, "sendSyncRequest" ]); -process.stdout.write("."); - -console.log("\nComplete!");
\ No newline at end of file diff --git a/includes/external/photo/output.png b/includes/external/photo/output.png Binary files differdeleted file mode 100644 index 81e14c9..0000000 --- a/includes/external/photo/output.png +++ /dev/null diff --git a/includes/external/photo/run.sh b/includes/external/photo/run.sh deleted file mode 100644 index 19c9c11..0000000 --- a/includes/external/photo/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -rm *.png -nice -n 19 node index.js
\ No newline at end of file diff --git a/includes/external/photo/temp.png b/includes/external/photo/temp.png Binary files differdeleted file mode 100644 index ece0ab8..0000000 --- a/includes/external/photo/temp.png +++ /dev/null |