mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-12-26 13:01:58 +00:00
Compare commits
No commits in common. "6abd1ed3e0a6f5b9ba08c7c6f7196a49e8efba81" and "02003b3b140ccd4d43d375e2930c3a0f3217d2c5" have entirely different histories.
6abd1ed3e0
...
02003b3b14
@ -154,6 +154,6 @@ Leading `"-"` indicates a not fully sorted shoot.
|
|||||||
- <date> - <info>/
|
- <date> - <info>/
|
||||||
```
|
```
|
||||||
|
|
||||||
This is the default as created by `sync-flash.sh`, renaming (removing the leading `"- "`) should be done by the user.
|
This is the defailt as creatrd by `sync-flash.sh`, renaming (removing the leading `"- "`) should be done by the user.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
# 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
|
||||||
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/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
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
#######################################################################
|
#######################################################################
|
||||||
#
|
#
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION=1.0
|
VERSION=1.0
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#!/usr/bin/env bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -113,9 +113,6 @@ 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',
|
||||||
@ -138,17 +135,14 @@ 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) }
|
||||||
@ -163,57 +157,36 @@ 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 {
|
|
||||||
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...
|
} else {
|
||||||
return Promise.all(readers)
|
// convert to a real dict...
|
||||||
.then(function(data){
|
// NOTE: exiftool appears to return an array
|
||||||
// convert to a real dict...
|
// object rather than an actual dict/object
|
||||||
// NOTE: exiftool appears to return an array
|
// and that is not JSON compatible....
|
||||||
// object rather than an actual dict/object
|
that.images[gid].metadata =
|
||||||
// and that is not JSON compatible....
|
Object.assign(
|
||||||
that.images[gid].metadata =
|
// XXX do we need to update or overwrite??
|
||||||
Object.assign(
|
that.images[gid].metadata || {},
|
||||||
// XXX do we need to update or overwrite??
|
data,
|
||||||
that.images[gid].metadata || {},
|
{
|
||||||
...data,
|
ImageGridMetadataReader: 'exiftool/ImageGrid',
|
||||||
{
|
// mark metadata as full read...
|
||||||
ImageGridMetadataReader: 'exiftool/ImageGrid',
|
ImageGridMetadata: 'full',
|
||||||
// mark metadata as full read...
|
})
|
||||||
ImageGridMetadata: 'full',
|
that.markChanged
|
||||||
})
|
&& that.markChanged('images', [gid]) }
|
||||||
that.markChanged
|
|
||||||
&& 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...
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ImageGrid.Viewer.g4",
|
"name": "ImageGrid.Viewer.g4",
|
||||||
"main": "index.html",
|
"main": "index.html",
|
||||||
"version": "4.0.11a",
|
"version": "4.0.10a",
|
||||||
"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",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user