bugfix...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-11-10 17:48:44 +03:00
parent 0a3140f888
commit bc7ee310c5
3 changed files with 11 additions and 10 deletions

View File

@ -125,11 +125,12 @@ module.EXIF_FORMAT = {
// XXX anything else??? // XXX anything else???
} }
// NOTE: this only reads the .rating from xmp...
var exifReader2exiftool = var exifReader2exiftool =
module.exifReader2exiftool = module.exifReader2exiftool =
function(data){ function(exif, xmp){
return Object.entries(EXIF_FORMAT) return Object.entries(EXIF_FORMAT)
// handle exif/image/... // handle exif...
.reduce(function(res, [path, to]){ .reduce(function(res, [path, to]){
var handler var handler
;[to, handler] = to instanceof Array ? ;[to, handler] = to instanceof Array ?
@ -141,7 +142,7 @@ function(data){
// resolve source path... // resolve source path...
var value = path.split(/\./g) var value = path.split(/\./g)
.reduce(function(res, e){ .reduce(function(res, e){
return res && res[e] }, data) return res && res[e] }, exif)
// set the value... // set the value...
if(value !== undefined){ if(value !== undefined){
res[to] = handler ? res[to] = handler ?
@ -150,11 +151,11 @@ function(data){
return res }, {}) return res }, {})
// handle xmp... // handle xmp...
.run(function(){ .run(function(){
var rating = data.xmp var rating = xmp
// NOTE: we do not need the full XML // NOTE: we do not need the full XML
// fluff here, just get some values... // fluff here, just get some values...
&& parseInt( && parseInt(
(data.xmp.toString() (xmp.toString()
.match(/(?<match><(xmp:Rating)[^>]*>(?<value>.*)<\/\2>)/i) .match(/(?<match><(xmp:Rating)[^>]*>(?<value>.*)<\/\2>)/i)
|| {groups: {}}) || {groups: {}})
.groups.value) .groups.value)
@ -735,7 +736,7 @@ var SharpActions = actions.Actions({
exif exif
&& Object.assign( && Object.assign(
img.metadata, img.metadata,
exifReader2exiftool(exif)) exifReader2exiftool(exif, metadata.xmp))
// if image too large, generate preview(s)... // if image too large, generate preview(s)...
// XXX EXPERIMENTAL... // XXX EXPERIMENTAL...

View File

@ -1117,9 +1117,9 @@
"integrity": "sha512-EzT4CP6d6lI8bnknNgT3W8mUQhSVXflO0yPbKD4dKsFcINiC6npjoEBz+8m3VQmWJhc+36pXD4JLwNxUEgzi+Q==" "integrity": "sha512-EzT4CP6d6lI8bnknNgT3W8mUQhSVXflO0yPbKD4dKsFcINiC6npjoEBz+8m3VQmWJhc+36pXD4JLwNxUEgzi+Q=="
}, },
"ig-types": { "ig-types": {
"version": "3.1.0", "version": "3.4.2",
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-3.1.0.tgz", "resolved": "https://registry.npmjs.org/ig-types/-/ig-types-3.4.2.tgz",
"integrity": "sha512-k/QbS9D30Fun3Xrh+6LHpCYsbQOwYlj1PX0uaNOnpmxg2tlWSdLOdykH8IMUbGIm/tI8MsJeKnJc4vu51s89Tg==", "integrity": "sha512-o/+xDUboKUyXF22iVRNYMxZNH8FeAzJ8qsRM8OQxW1+fLfF9/4iM20Rk+DN7Ctj05RRIkGilRTwKHb9ZITw23A==",
"requires": { "requires": {
"ig-object": "^5.2.8", "ig-object": "^5.2.8",
"object-run": "^1.0.1" "object-run": "^1.0.1"

View File

@ -32,7 +32,7 @@
"ig-argv": "^2.15.0", "ig-argv": "^2.15.0",
"ig-features": "^3.4.2", "ig-features": "^3.4.2",
"ig-object": "^5.2.8", "ig-object": "^5.2.8",
"ig-types": "^3.1.0", "ig-types": "^3.4.2",
"moment": "^2.29.1", "moment": "^2.29.1",
"object-run": "^1.0.1", "object-run": "^1.0.1",
"requirejs": "^2.3.6", "requirejs": "^2.3.6",