generated from nhcarrigan/template
chore: forgot to push this script but i got a id3v2 thing
Node.js CI / Lint and Test (push) Successful in 39s
Node.js CI / Lint and Test (push) Successful in 39s
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
/**
|
||||
* @copyright NHCarrigan
|
||||
* @license Naomi's Public License
|
||||
* @author Naomi Carrigan
|
||||
*/
|
||||
|
||||
import { exec } from "node:child_process";
|
||||
import { readdir } from "node:fs/promises";
|
||||
import { promisify } from "node:util";
|
||||
import { SingleBar, Presets } from "cli-progress";
|
||||
|
||||
const execAsync = promisify(exec);
|
||||
|
||||
const directory = "/home/naomi/down";
|
||||
const cover = "/home/naomi/neuro.png";
|
||||
|
||||
const files = await readdir(directory);
|
||||
|
||||
const bar = new SingleBar({}, Presets.shades_classic);
|
||||
|
||||
console.log(`Found ${files.length.toString()} files in ${directory}`);
|
||||
|
||||
bar.start(files.length, 0);
|
||||
|
||||
for (const file of files) {
|
||||
if (!file.endsWith(".mp3")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
await execAsync(
|
||||
`eyeD3 --add-image="${cover}":FRONT_COVER "${directory}/${file}"`,
|
||||
);
|
||||
|
||||
const title
|
||||
= /[""](?<title>.*)[""]/.exec(file)?.groups?.title
|
||||
?? file.replace(".mp3", "");
|
||||
const artist = "Neuro-sama";
|
||||
|
||||
await execAsync(
|
||||
`id3v2 "${directory}/${file}" --TIT2 "${title}" --TPE1 "${artist}"`,
|
||||
);
|
||||
bar.increment();
|
||||
}
|
||||
|
||||
bar.stop();
|
||||
console.log("Done!");
|
||||
Reference in New Issue
Block a user