use command line album, artist, and title values in file imports

This commit is contained in:
notgne2 2021-05-19 18:26:48 -07:00
parent 2c1b6545d2
commit 32001cfbcd
No known key found for this signature in database
GPG Key ID: BB661E172B42A7F8

View File

@ -44,6 +44,9 @@ async function thing() {
files = [{
image: null,
file: process.argv[2],
album: pAlbum || null,
artist: pArtist || null,
title: pTitle || null,
}];
} else {
console.log('got a link');
@ -116,8 +119,8 @@ async function thing() {
} of files) {
const path = `${os.homedir()}/Music/${album}/${artist} - ${title}.mp3`;
try {
await fs.mkdir(`${os.homedir()}/Music/${album}`, { recursive: true });
} catch (err) { }
await fs.mkdir(`${os.homedir()}/Music/${album}`, {recursive: true});
} catch (err) {}
try {
await fs.access(path);
@ -149,7 +152,7 @@ async function thing() {
}
console.log('Finished everything, cleaning up...');
await fs.rmdir(TMP_DIR, { recursive: true });
await fs.rmdir(TMP_DIR, {recursive: true});
console.log('Done!');
}
@ -158,11 +161,11 @@ async function thing() {
await thing();
} catch (err) {
console.error(err);
await fs.rmdir(TMP_DIR, { recursive: true });
await fs.rmdir(TMP_DIR, {recursive: true});
}
})();
process.on('SIGINT', async () => {
await fs.rmdir(TMP_DIR, { recursive: true });
await fs.rmdir(TMP_DIR, {recursive: true});
process.exit();
});