Skip to content

Commit

Permalink
Merge pull request #387 from noahm/renovate/jimp-1.x
Browse files Browse the repository at this point in the history
Update dependency jimp to v1
  • Loading branch information
noahm authored Nov 13, 2024
2 parents 418d8ee + 2e887c6 commit c3ae525
Show file tree
Hide file tree
Showing 10 changed files with 427 additions and 491 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"html-webpack-plugin": "5.6.3",
"iconv-lite": "0.6.3",
"inquirer": "9.3.7",
"jimp": "0.22.12",
"jimp": "1.6.0",
"jotai": "2.10.2",
"jsdom": "25.0.1",
"json-schema-to-typescript": "15.0.3",
Expand Down
6 changes: 3 additions & 3 deletions scripts/process-images.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* Place manually downloaded images into `new-jackets`
* and run this to downscale and post-proccess names
**/
import jimp from "jimp";
import { Jimp, ResizeStrategy } from "jimp";
import { statSync, readdirSync } from "fs";
import { resolve, join, dirname } from "path";

Expand All @@ -17,9 +17,9 @@ function transformFilename(f) {

async function processImg(input, output) {
try {
const img = await jimp.read(input);
const img = await Jimp.read(input);

await img.resize(200, jimp.AUTO).quality(80).writeAsync(output);
await img.resize({ w: 200, mode: ResizeStrategy.BILINEAR }).write(output);

console.log(
`Wrote ${output} (${(statSync(output).size / 1024).toFixed(0)}kb)`,
Expand Down
10 changes: 7 additions & 3 deletions scripts/utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { promises, existsSync } from "fs";
import { resolve, basename, join, dirname } from "path";
import { format } from "prettier";
import PQueue from "p-queue";
import jimp from "jimp";
import { Jimp, ResizeStrategy } from "jimp";
import BottomBar from "inquirer/lib/ui/bottom-bar.js";
import sanitize from "sanitize-filename";

Expand Down Expand Up @@ -117,6 +117,8 @@ function getOutputPath(coverUrl, localFilename) {
);
const outputPath = join(dirname(localFilename), sanitizedFilename);
return {
/** @type {"someFilePath.jpg"} */
// @ts-ignore
absolute: join(JACKETS_PATH, outputPath),
relative: outputPath.replace(/\\/g, "/"),
};
Expand All @@ -137,12 +139,14 @@ export function downloadJacket(coverUrl, localFilename = undefined) {
.add(
() => {
console.log("fetching", coverUrl);
return jimp.read(coverUrl);
return Jimp.read(coverUrl);
},
{ throwOnTimeout: true },
)
.then((img) =>
img.resize(128, jimp.AUTO).quality(80).writeAsync(absolute),
img
.resize({ w: 128, mode: ResizeStrategy.BILINEAR })
.write(absolute, { quality: 80 }),
)
.catch((e) => {
console.error("image download failure for", coverUrl);
Expand Down
Binary file added src/assets/jackets/smx/LoveToxic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/jackets/smx/Lunatic.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/jackets/smx/ParallelUniverse.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/jackets/smx/Paranoid.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/jackets/smx/Sengoku.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
108 changes: 107 additions & 1 deletion src/songs/smx.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{ "key": "team", "color": "#c216ce" }
],
"flags": ["andorfineMedia", "bassmonkeys", "cappRecords", "dimaMusic"],
"lastUpdated": 1728614892081
"lastUpdated": 1731463862015
},
"defaults": {
"style": "solo",
Expand Down Expand Up @@ -8407,6 +8407,112 @@
{ "style": "solo", "lvl": 20, "diffClass": "dual", "flags": ["plus"] },
{ "style": "solo", "lvl": 20, "diffClass": "full", "flags": ["plus"] }
]
},
{
"saIndex": "658",
"name": "Love Toxic",
"artist": "FACTOR-X",
"genre": "Electronica",
"bpm": "180",
"jacket": "smx/LoveToxic.jpg",
"charts": [
{ "style": "solo", "lvl": 4, "diffClass": "beginner" },
{ "style": "solo", "lvl": 7, "diffClass": "easy" },
{ "style": "solo", "lvl": 15, "diffClass": "hard" },
{ "style": "solo", "lvl": 21, "diffClass": "wild" },
{ "style": "solo", "lvl": 16, "diffClass": "dual" },
{ "style": "solo", "lvl": 16, "diffClass": "full" },
{ "style": "team", "lvl": 18, "diffClass": "team" },
{ "style": "solo", "lvl": 11, "diffClass": "easy", "flags": ["plus"] },
{ "style": "solo", "lvl": 17, "diffClass": "hard", "flags": ["plus"] },
{ "style": "solo", "lvl": 21, "diffClass": "dual", "flags": ["plus"] },
{ "style": "solo", "lvl": 21, "diffClass": "full", "flags": ["plus"] }
]
},
{
"saIndex": "659",
"name": "Lunatic",
"artist": "BLACK HOLE",
"genre": "Electronica",
"bpm": "100-400",
"jacket": "smx/Lunatic.jpg",
"charts": [
{ "style": "solo", "lvl": 3, "diffClass": "beginner" },
{ "style": "solo", "lvl": 6, "diffClass": "easy" },
{ "style": "solo", "lvl": 16, "diffClass": "hard" },
{ "style": "solo", "lvl": 23, "diffClass": "wild" },
{ "style": "solo", "lvl": 17, "diffClass": "dual" },
{ "style": "solo", "lvl": 17, "diffClass": "full" },
{ "style": "team", "lvl": 23, "diffClass": "team" },
{ "style": "solo", "lvl": 12, "diffClass": "easy", "flags": ["plus"] },
{ "style": "solo", "lvl": 19, "diffClass": "hard", "flags": ["plus"] },
{ "style": "solo", "lvl": 22, "diffClass": "dual", "flags": ["plus"] },
{ "style": "solo", "lvl": 24, "diffClass": "full", "flags": ["plus"] }
]
},
{
"saIndex": "660",
"name": "Parallel Universe",
"artist": "Omega",
"genre": "Electronica",
"bpm": "90-180",
"jacket": "smx/ParallelUniverse.jpg",
"charts": [
{ "style": "solo", "lvl": 4, "diffClass": "beginner" },
{ "style": "solo", "lvl": 7, "diffClass": "easy" },
{ "style": "solo", "lvl": 16, "diffClass": "hard" },
{ "style": "solo", "lvl": 25, "diffClass": "wild" },
{ "style": "solo", "lvl": 17, "diffClass": "dual" },
{ "style": "solo", "lvl": 17, "diffClass": "full" },
{ "style": "team", "lvl": 21, "diffClass": "team" },
{ "style": "solo", "lvl": 12, "diffClass": "easy", "flags": ["plus"] },
{ "style": "solo", "lvl": 20, "diffClass": "hard", "flags": ["plus"] },
{ "style": "solo", "lvl": 23, "diffClass": "dual", "flags": ["plus"] },
{ "style": "solo", "lvl": 25, "diffClass": "full", "flags": ["plus"] }
]
},
{
"saIndex": "661",
"name": "Paranoid",
"artist": "180",
"genre": "Electronica",
"bpm": "120-200",
"jacket": "smx/Paranoid.jpg",
"charts": [
{ "style": "solo", "lvl": 3, "diffClass": "beginner" },
{ "style": "solo", "lvl": 8, "diffClass": "easy" },
{ "style": "solo", "lvl": 16, "diffClass": "hard" },
{ "style": "solo", "lvl": 24, "diffClass": "wild" },
{ "style": "solo", "lvl": 17, "diffClass": "dual" },
{ "style": "solo", "lvl": 17, "diffClass": "full" },
{ "style": "team", "lvl": 26, "diffClass": "team" },
{ "style": "solo", "lvl": 13, "diffClass": "easy", "flags": ["plus"] },
{ "style": "solo", "lvl": 20, "diffClass": "hard", "flags": ["plus"] },
{ "style": "solo", "lvl": 24, "diffClass": "dual", "flags": ["plus"] },
{ "style": "solo", "lvl": 25, "diffClass": "full", "flags": ["plus"] }
]
},
{
"saIndex": "662",
"name": "戦国",
"name_translation": "Sengoku",
"artist": "Re-venG",
"genre": "Ethnic Electronica",
"bpm": "95-190",
"jacket": "smx/Sengoku.jpg",
"charts": [
{ "style": "solo", "lvl": 3, "diffClass": "beginner" },
{ "style": "solo", "lvl": 6, "diffClass": "easy" },
{ "style": "solo", "lvl": 14, "diffClass": "hard" },
{ "style": "solo", "lvl": 21, "diffClass": "wild" },
{ "style": "solo", "lvl": 15, "diffClass": "dual" },
{ "style": "solo", "lvl": 16, "diffClass": "full" },
{ "style": "team", "lvl": 23, "diffClass": "team" },
{ "style": "solo", "lvl": 11, "diffClass": "easy", "flags": ["plus"] },
{ "style": "solo", "lvl": 17, "diffClass": "hard", "flags": ["plus"] },
{ "style": "solo", "lvl": 21, "diffClass": "dual", "flags": ["plus"] },
{ "style": "solo", "lvl": 23, "diffClass": "full", "flags": ["plus"] }
]
}
]
}
Loading

0 comments on commit c3ae525

Please sign in to comment.