diff --git a/badger-am.js b/badger-am.js index e7446ae..455ed93 100755 --- a/badger-am.js +++ b/badger-am.js @@ -3,12 +3,9 @@ // requirements const os = require('os'); const path = require('path'); -const fs = require('fs'); -const fse = require('fs-extra'); const async = require('async'); const commander = require('commander'); const recursive = require('recursive-readdir'); - const app = require('./package.json'); const audio = require('./lib/audio'); const util = require('./lib/util'); @@ -60,7 +57,7 @@ function sort(input, output, options) { const bar = util.createProgressBar(files.length); // handle each file async.eachLimit(files, concurrency, function (file, eachCallback) { - processFile(output, file, function (err) { + processFileSort(output, file, function (err) { bar.tick(); if (err) { return eachCallback(err); @@ -84,7 +81,7 @@ function sort(input, output, options) { } // move file to location defined by its metadata -function processFile(output, sourceFile, callback) { +function processFileSort(output, sourceFile, callback) { async.waterfall([ function (asyncCallback) { audio.extractMetadata(sourceFile, asyncCallback) diff --git a/lib/audio.js b/lib/audio.js index 25166b8..c84a07f 100644 --- a/lib/audio.js +++ b/lib/audio.js @@ -1,4 +1,5 @@ // requirements +const fs = require('fs'); const metadata = require('musicmetadata'); // extract metadata for further processing diff --git a/lib/util.js b/lib/util.js index 382ab84..0274575 100644 --- a/lib/util.js +++ b/lib/util.js @@ -1,4 +1,7 @@ // requirements +const path = require('path'); +const async = require('async'); +const fse = require('fs-extra'); const progress = require('progress'); // print logo @@ -70,7 +73,7 @@ exports.moveFile = function moveFile(source, target, callback) { } callback(); }); -} +}; // fill a string beginning from the front exports.frontfill = function frontFill(string, fill, length) {