Migrate imgb64 to jimp (#163)

This commit is contained in:
Simon Lecoq
2021-03-02 01:42:04 +01:00
committed by GitHub
parent 4bbc59d3af
commit 46ef6a1532
15 changed files with 318 additions and 30 deletions

View File

@@ -100,7 +100,7 @@
next = cursor.hasNextPage
for (const {name:{full:name}, image:{medium:artwork}} of nodes) {
console.debug(`metrics/compute/${login}/plugins > anilist > processing ${name}`)
characters.push({name, artwork:artwork ? await imports.imgb64(artwork) : "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg=="})
characters.push({name, artwork:await imports.imgb64(artwork)})
}
}
catch (error) {
@@ -142,7 +142,7 @@
description:description.replace(/<br\s*\\?>/g, " "),
scores:{user:userScore, community:averageScore},
released:type === "ANIME" ? episodes : chapters,
artwork:artwork ? await imports.imgb64(artwork) : "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==",
artwork:await imports.imgb64(artwork),
}
}

View File

@@ -55,7 +55,7 @@
continue
}
if (!(login in contributors))
contributors[login] = {avatar:avatar ? await imports.imgb64(avatar) : "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg==", contributions:1, pr:[]}
contributors[login] = {avatar:await imports.imgb64(avatar), contributions:1, pr:[]}
else {
contributors[login].contributions++
contributors[login].pr.push(...(message.match(/(?<=[(])#\d+(?=[)])/g) ?? []))

View File

@@ -74,7 +74,7 @@
}
//Convert avatars to base64
console.debug(`metrics/compute/${login}/plugins > people > loading avatars`)
await Promise.all(result[type].map(async user => user.avatar = user.avatarUrl ? await imports.imgb64(user.avatarUrl) : "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mOcOnfpfwAGfgLYttYINwAAAABJRU5ErkJggg=="))
await Promise.all(result[type].map(async user => user.avatar = await imports.imgb64(user.avatarUrl)))
}
//Results