No longer using imgur API for individual images. Only saving EXIF data to JPEGs. Always using global exiftool instance.
This commit is contained in:
@@ -1,24 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
const exiftool = require('node-exiftool');
|
||||
const exiftoolBin = require('dist-exiftool');
|
||||
async function saveMeta(filepath, meta, ep) {
|
||||
await ep.writeMetadata(filepath, meta, ['overwrite_original']);
|
||||
|
||||
function saveMeta(filepath, meta, globalExifTool) {
|
||||
const ep = globalExifTool || new exiftool.ExiftoolProcess(exiftoolBin);
|
||||
|
||||
return Promise.resolve().then(() => {
|
||||
if(!globalExifTool) {
|
||||
return ep.open();
|
||||
}
|
||||
}).then(() => {
|
||||
return ep.writeMetadata(filepath, meta, ['overwrite_original']);
|
||||
}).then(() => {
|
||||
console.log('\x1b[36m%s\x1b[0m', `Wrote metadata to '${filepath}'`);
|
||||
}).then(() => {
|
||||
if(!globalExifTool) {
|
||||
return ep.close();
|
||||
}
|
||||
});
|
||||
};
|
||||
console.log('\x1b[36m%s\x1b[0m', `Wrote metadata to '${filepath}'`);
|
||||
}
|
||||
|
||||
module.exports = saveMeta;
|
||||
|
||||
Reference in New Issue
Block a user