use command line album, artist, and title values in file imports
This commit is contained in:
parent
2c1b6545d2
commit
32001cfbcd
13
index.js
13
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();
|
||||
});
|
Loading…
Reference in New Issue
Block a user