just another refactor
This commit is contained in:
parent
2673a6e2fa
commit
5cbbe1b7cf
62
badger-am.js
62
badger-am.js
|
@ -13,36 +13,42 @@ const util = require('./lib/util');
|
||||||
// generate timestamp
|
// generate timestamp
|
||||||
const start = process.hrtime();
|
const start = process.hrtime();
|
||||||
|
|
||||||
util.printLogo();
|
main();
|
||||||
|
|
||||||
// general options
|
// "main"
|
||||||
commander
|
function main() {
|
||||||
.version(app.version)
|
util.printLogo();
|
||||||
.usage('[options] <command>')
|
parseCLI();
|
||||||
.option('-c, --concurrency <n>', 'specify concurrency level', os.cpus().length);
|
}
|
||||||
|
|
||||||
// conversion mode
|
// process command line arguments
|
||||||
commander
|
function parseCLI() {
|
||||||
.command('convert <input> <output>')
|
// general options
|
||||||
.description('convert .flac to .mp3 files')
|
commander
|
||||||
.option('-b, --bitrate <n>', 'specify conversion bitrate', 320)
|
.version(app.version)
|
||||||
.action(function (input, output, options) {
|
.usage('[options] <command>')
|
||||||
console.log('--- CONVERT MODE ---');
|
.option('-c, --concurrency <n>', 'specify concurrency level', os.cpus().length);
|
||||||
console.log('input: ' + input);
|
// conversion mode
|
||||||
console.log('output: ' + output);
|
commander
|
||||||
console.log('bitrate: ' + commander.options.bitrate);
|
.command('convert <input> <output>')
|
||||||
console.log('conc: ' + commander.concurrency);
|
.description('convert .flac to .mp3 files')
|
||||||
});
|
.option('-b, --bitrate <n>', 'specify conversion bitrate', 320)
|
||||||
|
.action(function (input, output, options) {
|
||||||
// sort mode
|
console.log('--- CONVERT MODE ---');
|
||||||
commander
|
console.log('input: ' + input);
|
||||||
.command('sort <input> <output>')
|
console.log('output: ' + output);
|
||||||
.description('sort audio files by tags')
|
console.log('bitrate: ' + commander.options.bitrate);
|
||||||
.option('-f, --format <type>', 'specify audio format (\'flac\', \'mp3\')', 'flac')
|
console.log('conc: ' + commander.concurrency);
|
||||||
.action(sort);
|
});
|
||||||
|
// sort mode
|
||||||
// parse command line arguments
|
commander
|
||||||
commander.parse(process.argv);
|
.command('sort <input> <output>')
|
||||||
|
.description('sort audio files by tags')
|
||||||
|
.option('-f, --format <type>', 'specify audio format (\'flac\', \'mp3\')', 'flac')
|
||||||
|
.action(sort);
|
||||||
|
// parse command line arguments
|
||||||
|
commander.parse(process.argv);
|
||||||
|
}
|
||||||
|
|
||||||
// sort files
|
// sort files
|
||||||
function sort(input, output, options) {
|
function sort(input, output, options) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "badger-am",
|
"name": "badger-am",
|
||||||
"version": "0.2.1",
|
"version": "0.2.2",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"description": "audio manager",
|
"description": "audio manager",
|
||||||
"author": "Daniel Sommer <daniel.sommer@velvettear.de>",
|
"author": "Daniel Sommer <daniel.sommer@velvettear.de>",
|
||||||
|
|
Loading…
Reference in a new issue