-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
I found a problem with your code. When calling Exif multiple times with settings.args as a variable the filename is pushed to the args instead of being replaced.
Test:
const Exif = require('simple-exiftool');
function print(metadata) { console.log('result', metadata.SourceFile); }
function err(error) { console.log('error', error); }
const args = ['-json'];
function read(file) {
return new Promise(function(resolve, reject) {
console.log('file: %s, args:', file, args);
Exif(file, {
binary: "exiftool",
args: args
}, (error, metadata) => {
if (error) reject(error);
if (metadata.length) reject(new Error('to many results: '+ metadata.length));
resolve(metadata);
});
})
}
read('one.mp3').then(print, err);
read('two.mp3').then(print, err);
read('three.mp3').then(print, err);Output:
file: one.mp3, args: [ '-json' ]
file: two.mp3, args: [ '-json', 'one.mp3' ]
file: three.mp3, args: [ '-json', 'one.mp3', 'two.mp3' ]
result one.mp3
error [Error: to many results: 3]
error [Error: to many results: 2]
Metadata
Metadata
Assignees
Labels
No labels