diff --git a/README.md b/README.md index e0e4e53..960d262 100644 --- a/README.md +++ b/README.md @@ -303,6 +303,8 @@ If you are a developer please feel free to get involved and send a pull request your enhancements or bugfix. ## Release History +* 0.6.1 + * fixed https://github.com/dylansmith/node-exif-renamer/issues/1 * 0.6.0 * changed the way the target directory is specified in renaming templates, since the current approach flattens relative paths when doing recursive renaming. The renaming template now diff --git a/bin/exif-renamer b/bin/exif-renamer index 0b19bed..cbfa64a 100755 --- a/bin/exif-renamer +++ b/bin/exif-renamer @@ -4,6 +4,7 @@ var cli = require('cli'), clr = require('cli-color'), fs = require('fs'), path = require('path'), + _ = require('lodash'), glob = require('glob'), Handlebars = require('handlebars'), exifRenamer = require('../lib/exif-renamer')(); @@ -21,18 +22,20 @@ cli.parse({ cli.main(function(args, options) { - function reporter(err, result) { + function reporter(err, results) { if (err) { cli.error(err); } - else if (result) { + else if (results) { + results = (_.isArray(results)) ? results : [results]; var tmpl = [ clr.cyan('[old] ' + '{{original.path}}'), - clr.green('[new] ' + '{{processed.path}}') + clr.green('[new] ' + '{{processed.path}}\n') ].join('\n'); - cli.info((options.dryrun) ? 'dry run ' : 'image renamed'); - console.log(Handlebars.compile(tmpl)(result)); - console.log(''); + results.forEach(function(result) { + cli.info((options.dryrun) ? 'dry run ' : 'image renamed'); + console.log(Handlebars.compile(tmpl)(result)); + }); } } @@ -74,7 +77,7 @@ cli.main(function(args, options) { if (!is_dir) { return cli.fatal('the --recursive option requires a valid directory'); } - exifRenamer.rename_dir(p, options.template, reporter, true); + exifRenamer.rename_dir(p, options.template, true, reporter); } else if (options.exif) { diff --git a/package.json b/package.json index eab70c0..5e7c9a3 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "exif-renamer", "description": "A NodeJS library & shell command to rename photos using their EXIF data.", - "version": "0.6.0", + "version": "0.6.1", "homepage": "https://github.com/dylansmith/node-exif-renamer", "author": { "name": "Dylan Smith",