diff --git a/package.json b/package.json index 266374f..547c7c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "publikator", - "version": "0.8.0", + "version": "0.9.0", "main": "index.js", "repository": "https://github.com/aengl/publikator.git", "author": "Lynn Smeria ", diff --git a/src/cli.js b/src/cli.js index 2523746..a0fe820 100644 --- a/src/cli.js +++ b/src/cli.js @@ -22,7 +22,7 @@ program.version(packageJson.version); program .command( 'organise', - 'Recursively finds all mp3s in a folder, reads their tags and re-organises them' + 'Recursively finds all tracks in a folder, reads their tags and re-organises them' ) .argument('', 'Root folder for the recursive search') .argument('', 'Target folder for the restructured output') diff --git a/src/scan.js b/src/scan.js index 56b3510..41e3276 100644 --- a/src/scan.js +++ b/src/scan.js @@ -1,19 +1,50 @@ const debug = require('debug')('publikator:scan'); +const path = require('path'); const walk = require('walkdir'); const tags = require('./tags'); +const extensions = new Set([ + '.3gp', + '.aac', + '.aif', + '.aifc', + '.aiff', + '.ape', + '.asf', + '.flac', + '.m2a', + '.m4a', + '.m4b', + '.m4p', + '.m4r', + '.m4v', + '.mp2', + '.mp3', + '.mp3', + '.mp4', + '.oga', + '.ogg', + '.ogv', + '.ogx', + '.opus', + '.wav', + '.wma', + '.wmv', + '.wv', + '.wvp', +]); + module.exports = { /** * Recursively searches for files. */ - findFilesSync: (root, extension = '.mp3') => { - debug( - `scanning directory '${root}' for files with extension '${extension}'` - ); + findFilesSync: root => { + debug(`scanning directory '${root}' for audio tracks`); const files = []; - walk.sync(root, path => { - if (path.endsWith(extension)) { - files.push(path); + walk.sync(root, filePath => { + const ext = path.extname(filePath); + if (extensions.has(ext)) { + files.push(filePath); } }); debug(`found ${files.length} file(s)`);