From 32001cfbcdb5bfaeb5644479725b046b9e2e53c2 Mon Sep 17 00:00:00 2001 From: notgne2 Date: Wed, 19 May 2021 18:26:48 -0700 Subject: [PATCH] use command line album, artist, and title values in file imports --- index.js | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index 6e2f273..f25b552 100644 --- a/index.js +++ b/index.js @@ -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(); -}); \ No newline at end of file +});