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