-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: the main export has been removed since the version was incorrect
- Loading branch information
Showing
3 changed files
with
34 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,37 @@ | ||
#!/usr/bin/env node | ||
|
||
const { main } = require('../dist/index.cjs'); | ||
const { Command } = require('commander'); | ||
|
||
main(); | ||
const { description, name, version } = require('../package.json'); | ||
const { Downloader, YtdlMp3Error } = require('../dist/index.cjs'); | ||
|
||
const program = new Command(); | ||
program.name(name); | ||
program.description(description); | ||
program.version(version); | ||
program.allowExcessArguments(false); | ||
program.argument('<url>', 'url of video to download'); | ||
program.option('-o --output-dir <path>', 'path to output directory', Downloader.defaultDownloadsDir); | ||
program.option('-n --no-get-tags', 'skip extracting/applying id3 tags'); | ||
program.option('-v --verify-tags', 'verify id3 tags fetched from itunes'); | ||
program.option('-s --silent-mode', 'skip console output'); | ||
program.option('--verbose', 'enable verbose mode'); | ||
program.parse(); | ||
|
||
(async function () { | ||
const options = program.opts(); | ||
try { | ||
const downloader = new Downloader(options); | ||
await downloader.downloadSong(program.args[0]); | ||
} catch (err) { | ||
if (err instanceof YtdlMp3Error) { | ||
if (options.verbose) { | ||
console.error(err.cause); | ||
console.error(err.stack); | ||
} | ||
console.error(`ERROR: ${err.message}`); | ||
process.exit(1); | ||
} | ||
throw err; | ||
} | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
export * from './Downloader'; | ||
export * from './FormatConverter'; | ||
export * from './SongTagsSearch'; | ||
export { main } from './main'; | ||
export { YtdlMp3Error } from './utils'; |
This file was deleted.
Oops, something went wrong.