From d4a99bf98fb61c5a12eba206d411eae719af7f17 Mon Sep 17 00:00:00 2001 From: Nemo Date: Mon, 28 Jun 2021 15:04:09 +0530 Subject: [PATCH] Improve helptext --- index.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/index.js b/index.js index ab932f5..6f59533 100755 --- a/index.js +++ b/index.js @@ -9,25 +9,32 @@ let argv = minimist(process.argv.slice(2), { string: 'audio-file' }); -if (argv._.length <2 || argv.help ){ +if (argv._.length <1 || argv.help ){ console.log(`Usage - $ youtube-cue [--audio-file audio.m4a] + $ youtube-cue [--audio-file audio.m4a] [output_file] Options --help, Show help - --audio-file, Input Audio File (optional) + --audio-file, Input Audio File (optional) that is written to the CUE sheet + + The default audio file is set to %VIDEOTITLE.m4a + The default output file is set to %VIDEOTITLE.cue + + where $VIDEOTITLE is the title of the YouTube video. Examples - $ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=THzUassmQwE" output.cue - output.cue saved + $ youtube-cue --audio-file audio.m4a "https://www.youtube.com/watch?v=THzUassmQwE" + "T A Y L O R S W I F T – Folklore [Full album].cue" saved $ youtube-cue "https://youtu.be/THzUassmQwE" folklore.cue folklore.cue saved`) } else { let url = argv._[0] - let output_file = argv._[1] ytdl.getInfo(url).then(info=>{ let audioFile = argv['audio-file']? argv['audio-file'] : `${info.videoDetails.title}.m4a` + + let output_file = argv._[1]? argv._[1] : `${info.videoDetails.title}.cue` + let res = getArtistTitle(info.videoDetails.title,{ defaultArtist: "Unknown Artist", defaultTitle: info.videoDetails.title @@ -36,5 +43,6 @@ if (argv._.length <2 || argv.help ){ artist = (info.videoDetails.media ? info.videoDetails.media.artist : artist) let tracks = parse(info.videoDetails.description, {artist}) generate({tracks, artist, audioFile, album}, output_file) + console.log(`"${output_file}" saved`) }) }