changing convert to magick command because of deprecation
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 17s
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 17s
This commit is contained in:
parent
c1f06de7c5
commit
7028d92d5e
|
@ -32,7 +32,7 @@ for(let item of items) {
|
||||||
if(mime.startsWith('video/') || mime == 'image/gif')
|
if(mime.startsWith('video/') || mime == 'image/gif')
|
||||||
await exec(`ffmpegthumbnailer -i./public/b/${filename} -s1024 -o./tmp/${itemid}.png`);
|
await exec(`ffmpegthumbnailer -i./public/b/${filename} -s1024 -o./tmp/${itemid}.png`);
|
||||||
else if(mime.startsWith('image/') && mime != 'image/gif')
|
else if(mime.startsWith('image/') && mime != 'image/gif')
|
||||||
await exec(`convert ./public/b/${filename} ./tmp/${itemid}.png`);
|
await exec(`magick ./public/b/${filename} ./tmp/${itemid}.png`);
|
||||||
else if(mime.startsWith('audio/')) {
|
else if(mime.startsWith('audio/')) {
|
||||||
if(link.match(/soundcloud/)) {
|
if(link.match(/soundcloud/)) {
|
||||||
let cover = (await exec(`yt-dlp --get-thumbnail "${link}"`)).stdout.trim();
|
let cover = (await exec(`yt-dlp --get-thumbnail "${link}"`)).stdout.trim();
|
||||||
|
@ -42,8 +42,8 @@ for(let item of items) {
|
||||||
await exec(`wget "${cover}" -O ./tmp/${itemid}.jpg`);
|
await exec(`wget "${cover}" -O ./tmp/${itemid}.jpg`);
|
||||||
const size = (await fs.promises.stat(`./tmp/${itemid}.jpg`)).size;
|
const size = (await fs.promises.stat(`./tmp/${itemid}.jpg`)).size;
|
||||||
if(size >= 0) {
|
if(size >= 0) {
|
||||||
await exec(`convert ./tmp/${itemid}.jpg ./tmp/${itemid}.png`);
|
await exec(`magick ./tmp/${itemid}.jpg ./tmp/${itemid}.png`);
|
||||||
await exec(`convert ./tmp/${itemid}.jpg ./public/ca/${itemid}.webp`);
|
await exec(`magick ./tmp/${itemid}.jpg ./public/ca/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
//console.log(err);
|
//console.log(err);
|
||||||
|
@ -51,21 +51,21 @@ for(let item of items) {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
await exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
||||||
await exec(`convert ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
await exec(`magick ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
await exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
||||||
await exec(`convert ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
await exec(`magick ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await exec(`convert "./tmp/${itemid}.png" -resize "128x128^" -gravity center -crop 128x128+0+0 +repage ./public/t/${itemid}.webp`);
|
await exec(`magick "./tmp/${itemid}.png" -resize "128x128^" -gravity center -crop 128x128+0+0 +repage ./public/t/${itemid}.webp`);
|
||||||
await fs.promises.unlink(`./tmp/${itemid}.png`).catch(err => {});
|
await fs.promises.unlink(`./tmp/${itemid}.png`).catch(err => {});
|
||||||
await fs.promises.unlink(`./tmp/${itemid}.jpg`).catch(err => {});
|
await fs.promises.unlink(`./tmp/${itemid}.jpg`).catch(err => {});
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
//console.log(err);
|
//console.log(err);
|
||||||
await exec(`convert ./mugge.png ./public/t/${itemid}.webp`);
|
await exec(`magick ./mugge.png ./public/t/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
console.log(`current: ${itemid} (${count} / ${total})`);
|
console.log(`current: ${itemid} (${count} / ${total})`);
|
||||||
count++;
|
count++;
|
||||||
|
@ -76,7 +76,7 @@ for(let item of items) {
|
||||||
const itemid = item.id;
|
const itemid = item.id;
|
||||||
const filename = item.dest;
|
const filename = item.dest;
|
||||||
await exec(`ffmpegthumbnailer -i./public/b/${filename} -s1024 -o./debug/tmp/${itemid}`);
|
await exec(`ffmpegthumbnailer -i./public/b/${filename} -s1024 -o./debug/tmp/${itemid}`);
|
||||||
await exec(`convert "./debug/tmp/${itemid}" -resize "128x128^" -gravity center -crop 128x128+0+0 +repage ./public/t/${itemid}.png`);
|
await exec(`magick "./debug/tmp/${itemid}" -resize "128x128^" -gravity center -crop 128x128+0+0 +repage ./public/t/${itemid}.png`);
|
||||||
await fs.unlink(`./debug/tmp/${itemid}`);
|
await fs.unlink(`./debug/tmp/${itemid}`);
|
||||||
console.log(`current: ${itemid} (${count} / ${total})`);
|
console.log(`current: ${itemid} (${count} / ${total})`);
|
||||||
} catch(err) {}
|
} catch(err) {}
|
||||||
|
|
|
@ -62,7 +62,7 @@ export default new class queue {
|
||||||
if(mime.startsWith('video/') || mime == 'image/gif')
|
if(mime.startsWith('video/') || mime == 'image/gif')
|
||||||
await this.exec(`ffmpegthumbnailer -i./public/b/${filename} -s1024 -o./tmp/${itemid}.png`);
|
await this.exec(`ffmpegthumbnailer -i./public/b/${filename} -s1024 -o./tmp/${itemid}.png`);
|
||||||
else if(mime.startsWith('image/') && mime != 'image/gif')
|
else if(mime.startsWith('image/') && mime != 'image/gif')
|
||||||
await this.exec(`convert "./public/b/${filename}[0]" ./tmp/${itemid}.png`);
|
await this.exec(`magick "./public/b/${filename}[0]" ./tmp/${itemid}.png`);
|
||||||
else if(mime.startsWith('audio/')) {
|
else if(mime.startsWith('audio/')) {
|
||||||
if(link.match(/soundcloud/)) {
|
if(link.match(/soundcloud/)) {
|
||||||
let cover = (await this.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --get-thumbnail "${link}"`)).stdout.trim();
|
let cover = (await this.exec(`yt-dlp -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --get-thumbnail "${link}"`)).stdout.trim();
|
||||||
|
@ -72,23 +72,23 @@ export default new class queue {
|
||||||
await this.exec(`wget "${cover}" -O ./tmp/${itemid}.jpg`);
|
await this.exec(`wget "${cover}" -O ./tmp/${itemid}.jpg`);
|
||||||
const size = (await fs.promises.stat(`./tmp/${itemid}.jpg`)).size;
|
const size = (await fs.promises.stat(`./tmp/${itemid}.jpg`)).size;
|
||||||
if(size >= 0) {
|
if(size >= 0) {
|
||||||
await this.exec(`convert ./tmp/${itemid}.jpg ./tmp/${itemid}.png`);
|
await this.exec(`magick ./tmp/${itemid}.jpg ./tmp/${itemid}.png`);
|
||||||
await this.exec(`convert ./tmp/${itemid}.jpg ./public/ca/${itemid}.webp`);
|
await this.exec(`magick ./tmp/${itemid}.jpg ./public/ca/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
} catch(err) {}
|
} catch(err) {}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await this.exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
await this.exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
||||||
await this.exec(`convert ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
await this.exec(`magick ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await this.exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
await this.exec(`ffmpeg -i ./public/b/${filename} -update 1 -map 0:v -map 0:1 -c copy ./tmp/${itemid}.png`);
|
||||||
await this.exec(`convert ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
await this.exec(`magick ./tmp/${itemid}.png ./public/ca/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.exec(`convert "./tmp/${itemid}.png" -resize "128x128^" -gravity center -crop 128x128+0+0 +repage ./public/t/${itemid}.webp`);
|
await this.exec(`magick "./tmp/${itemid}.png" -resize "128x128^" -gravity center -crop 128x128+0+0 +repage ./public/t/${itemid}.webp`);
|
||||||
await fs.promises.unlink(`./tmp/${itemid}.png`).catch(_=>{});
|
await fs.promises.unlink(`./tmp/${itemid}.png`).catch(_=>{});
|
||||||
await fs.promises.unlink(`./tmp/${itemid}.jpg`).catch(_=>{});
|
await fs.promises.unlink(`./tmp/${itemid}.jpg`).catch(_=>{});
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -247,7 +247,7 @@ export default async bot => {
|
||||||
try {
|
try {
|
||||||
await queue.genThumbnail(filename, mime, itemid, link);
|
await queue.genThumbnail(filename, mime, itemid, link);
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
await queue.exec(`convert ./mugge.png ./public/t/${itemid}.webp`);
|
await queue.exec(`magick ./mugge.png ./public/t/${itemid}.webp`);
|
||||||
}
|
}
|
||||||
|
|
||||||
let speed = lib.calcSpeed(size, end);
|
let speed = lib.calcSpeed(size, end);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user