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

View File

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

View File

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