diff options
author | Minteck <contact@minteck.org> | 2022-02-09 20:32:50 +0100 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-02-09 20:32:50 +0100 |
commit | e7a5516fbb5643847a86a254ea732142e02edbbe (patch) | |
tree | ea39d6bc3915e08b0aa0cfdd119490b2ada9ebc9 | |
parent | e08d29ce6ecb59f876876ac49414ee1185b0b851 (diff) | |
download | youtoo-e7a5516fbb5643847a86a254ea732142e02edbbe.tar.gz youtoo-e7a5516fbb5643847a86a254ea732142e02edbbe.tar.bz2 youtoo-e7a5516fbb5643847a86a254ea732142e02edbbe.zip |
Add optional argument to override album
-rw-r--r-- | README.md | 6 | ||||
-rw-r--r-- | index.js | 9 | ||||
-rw-r--r-- | package.json | 2 |
3 files changed, 13 insertions, 4 deletions
@@ -21,14 +21,16 @@ First, go to the folder where you downloaded the source code (the folder where t On Windows (PowerShell): ``` -node .\index.js <your YouTube playlist ID> +node .\index.js <your YouTube playlist ID> [album name] ``` On POSIX systems (Linux, macOS, *BSD, ...): ``` -./youtoo <your YouTube playlist ID> +./youtoo <your YouTube playlist ID> [album name] ``` +> Argument `[album name]` is optional. If used, YouToo will make it so that all the songs belong to the same album rather than the auto-detected albums. Useful to keep playlists organized. + After running this command (and after waiting while it runs), you get the final audio files in `./_youtoo/Result`, it is suggested that you keep these here for syncing to work (e.g. use a symbolic link). ## How does it work? @@ -30,6 +30,13 @@ console.log("Please specify playlist ID"); } + if (process.argv[3] !== undefined) { + global.overrideAlbum = true; + global.overrideAlbumName = process.argv[3]; + } else { + global.overrideAlbum = false; + } + console.log("Preparing folder structure..."); if (!fs.existsSync("./_youtoo")) fs.mkdirSync("./_youtoo"); if (!fs.existsSync("./_youtoo/Dumps")) fs.mkdirSync("./_youtoo/Dumps"); @@ -79,7 +86,7 @@ video: metadata.title, title: songTitle, date: metadata.release_year ?? (metadata.upload_date.substring(0, 4) - 1 +1), - album: metadata.album ?? ((metadata.track ?? metadata.alt_title ?? metadata.title).replace(/^([:\"'a-zA-Z0-9 .\-*\_\/\\,&]*)-( |)(.*)(\[(.*)\]|)/gm, "$3").replace(/(.*)\((feat|ft|with)(\.|:| |)(| |)([:\"'a-zA-Z0-9 .\-*\_\/\\,&]*)\)(.*)/gmi, "$1").replace(/(.*)\[(.*)\](.*)/gm, "$1").replace(/(.*)\((from|in|by)(\.|:| |)(| |)([:\"'a-zA-Z0-9 .\-*\_\/\\,&]*)\)(.*)/gmi, "$1").trim()), + album: overrideAlbum ? overrideAlbumName : metadata.album ?? ((metadata.track ?? metadata.alt_title ?? metadata.title).replace(/^([:\"'a-zA-Z0-9 .\-*\_\/\\,&]*)-( |)(.*)(\[(.*)\]|)/gm, "$3").replace(/(.*)\((feat|ft|with)(\.|:| |)(| |)([:\"'a-zA-Z0-9 .\-*\_\/\\,&]*)\)(.*)/gmi, "$1").replace(/(.*)\[(.*)\](.*)/gm, "$1").replace(/(.*)\((from|in|by)(\.|:| |)(| |)([:\"'a-zA-Z0-9 .\-*\_\/\\,&]*)\)(.*)/gmi, "$1").trim()), potentialArtists: partists, potentialArtists2: partists2, artists: artistsList, diff --git a/package.json b/package.json index ee3a1ee..c3e3eca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "youtoo", - "version": "1.2.25", + "version": "1.2.26", "description": "A program that downloads, sorts and names music from YouTube", "main": "index.js", "scripts": { |