Compare commits

..

4 Commits

Author SHA1 Message Date
6abd1ed3e0 tweaking...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-06-27 16:13:17 +03:00
ebb6d282f1 added xmp sidecar support when reading all metadata...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-06-27 15:53:34 +03:00
78891e7d22 Merge branch 'master' of github.com:flynx/ImageGrid 2024-06-17 23:46:58 +03:00
d699e22970 updated the shabang...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
2024-05-25 18:48:30 +03:00
8 changed files with 59 additions and 33 deletions

View File

@ -154,6 +154,6 @@ Leading `"-"` indicates a not fully sorted shoot.
- <date> - <info>/ - <date> - <info>/
``` ```
This is the defailt as creatrd by `sync-flash.sh`, renaming (removing the leading `"- "`) should be done by the user. This is the default as created by `sync-flash.sh`, renaming (removing the leading `"- "`) should be done by the user.

View File

@ -1,5 +1,4 @@
Base photo archive directory # Base photo archive directory
----------------------------
This tree is created based on the specification from: This tree is created based on the specification from:
https://github.com/flynx/ImageGrid/blob/master/Archive/README.md https://github.com/flynx/ImageGrid/blob/master/Archive/README.md

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# TODO make this runnable from anywhere... # TODO make this runnable from anywhere...
# - prepend paths with './' only if local/relative # - prepend paths with './' only if local/relative

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
# #
####################################################################### #######################################################################
# #

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash
VERSION=1.0 VERSION=1.0

View File

@ -1,4 +1,4 @@
#!/bin/bash #!/usr/bin/env bash

View File

@ -113,6 +113,9 @@ var MetadataReaderActions = actions.Actions({
- force is true - force is true
NOTE: this will read metadata from both the image file as well as sidecar
(xmp) files, if available
NOTE: sidecar metadata fields take precedence over image metadata.
NOTE: also see: .cacheMetadata(..) NOTE: also see: .cacheMetadata(..)
`, `,
core.sessionQueueHandler('Read image metadata', core.sessionQueueHandler('Read image metadata',
@ -135,14 +138,17 @@ var MetadataReaderActions = actions.Actions({
if(!image && !img){ if(!image && !img){
return false } return false }
if(!force
&& (img.metadata || {}).ImageGridMetadata == 'full'){
return Promise.resolve(img.metadata) }
//var full_path = path.normalize(img.base_path +'/'+ img.path) //var full_path = path.normalize(img.base_path +'/'+ img.path)
var full_path = this.getImagePath(gid) var full_path = this.getImagePath(gid)
return new Promise(function(resolve, reject){
if(!force
&& (img.metadata || {}).ImageGridMetadata == 'full'){
return resolve(img.metadata) }
var readers = []
// main image...
readers.push(new Promise(function(resolve, reject){
fs.readFile(full_path, function(err, file){ fs.readFile(full_path, function(err, file){
if(err){ if(err){
return reject(err) } return reject(err) }
@ -157,18 +163,41 @@ var MetadataReaderActions = actions.Actions({
img.ctime = stat.ctime img.ctime = stat.ctime
img.birthtime = stat.birthtime img.birthtime = stat.birthtime
img.size = stat.size img.size = stat.size }
}
// read image metadata... // read image metadata...
exiftool.metadata(file, function(err, data){ exiftool.metadata(file, function(err, data){
if(err){ if(err){
reject(err) reject(err)
} else if(data.error){ } else if(data.error){
reject(data) reject(data)
} else { } else {
resolve(data) } }) }) }) )
// XMP sidecar files...
// NOTE: sidecar files take precedence over image metadata...
for(var ext of ['xmp', 'XMP']){
var xmp_path = full_path.replace(/\.[a-zA-Z0-9]*$/, '.'+ ext)
if(fs.existsSync(xmp_path)){
readers.push(new Promise(function(resolve, reject){
fs.readFile(xmp_path, function(err, file){
if(err){
// XXX log error...
resolve({}) }
exiftool.metadata(file, function(err, data){
if(err){
// XXX log error...
resolve({})
} else if(data.error){
// XXX log error...
resolve({})
} else {
console.log("@@@@", data)
resolve(data) } }) }) }))
break } }
// merge the data...
return Promise.all(readers)
.then(function(data){
// convert to a real dict... // convert to a real dict...
// NOTE: exiftool appears to return an array // NOTE: exiftool appears to return an array
// object rather than an actual dict/object // object rather than an actual dict/object
@ -177,16 +206,14 @@ var MetadataReaderActions = actions.Actions({
Object.assign( Object.assign(
// XXX do we need to update or overwrite?? // XXX do we need to update or overwrite??
that.images[gid].metadata || {}, that.images[gid].metadata || {},
data, ...data,
{ {
ImageGridMetadataReader: 'exiftool/ImageGrid', ImageGridMetadataReader: 'exiftool/ImageGrid',
// mark metadata as full read... // mark metadata as full read...
ImageGridMetadata: 'full', ImageGridMetadata: 'full',
}) })
that.markChanged that.markChanged
&& that.markChanged('images', [gid]) } && that.markChanged('images', [gid]) }) })],
resolve(data) }) }) }) })],
// XXX Q: should this be a linked task??? // XXX Q: should this be a linked task???
// ...on one hand yes, on the other, saving after this may // ...on one hand yes, on the other, saving after this may
// unintentionally save other state from the main object... // unintentionally save other state from the main object...

View File

@ -1,7 +1,7 @@
{ {
"name": "ImageGrid.Viewer.g4", "name": "ImageGrid.Viewer.g4",
"main": "index.html", "main": "index.html",
"version": "4.0.10a", "version": "4.0.11a",
"author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)", "author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)",
"contributors": [], "contributors": [],
"repository": "github:flynx/ImageGrid", "repository": "github:flynx/ImageGrid",