mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
reworked metadata caching...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
af3f85ae4c
commit
b2ba27d82f
@ -432,12 +432,12 @@ var CLIActions = actions.Actions({
|
|||||||
|
|
||||||
// XXX this is still wrong...
|
// XXX this is still wrong...
|
||||||
_makeIndex: ['- System/',
|
_makeIndex: ['- System/',
|
||||||
`chain:
|
`chain: [
|
||||||
"loadImages: $1"
|
"loadImages: $1",
|
||||||
"saveIndex"
|
"saveIndex",
|
||||||
"makePreviews: 'all'"
|
"makePreviews: 'all'",
|
||||||
"sortImages"
|
"sortImages",
|
||||||
"saveIndex"`],
|
"saveIndex", ]`],
|
||||||
|
|
||||||
// XXX does not work yet...
|
// XXX does not work yet...
|
||||||
updateIndex: ['- System/Update index',
|
updateIndex: ['- System/Update index',
|
||||||
|
|||||||
@ -2716,6 +2716,19 @@ function(title, func){
|
|||||||
var q
|
var q
|
||||||
var inputs = [items, ...args]
|
var inputs = [items, ...args]
|
||||||
|
|
||||||
|
// pre-process args...
|
||||||
|
arg_handler
|
||||||
|
&& (inputs = arg_handler.call(this,
|
||||||
|
sync == 'sync' ?
|
||||||
|
sync
|
||||||
|
: q,
|
||||||
|
...inputs))
|
||||||
|
// special-case: empty inputs -- no need to handle anything...
|
||||||
|
if(inputs instanceof Array
|
||||||
|
&& inputs[0]
|
||||||
|
&& inputs[0].length == 0){
|
||||||
|
return Promise.resolve(inputs) }
|
||||||
|
|
||||||
// Define the runner and prepare...
|
// Define the runner and prepare...
|
||||||
//
|
//
|
||||||
// sync mode -- run action outside of queue...
|
// sync mode -- run action outside of queue...
|
||||||
@ -2759,14 +2772,6 @@ function(title, func){
|
|||||||
: [items, ...args]))
|
: [items, ...args]))
|
||||||
return q.promise() } }
|
return q.promise() } }
|
||||||
|
|
||||||
// pre-process args...
|
|
||||||
arg_handler
|
|
||||||
&& (inputs = arg_handler.call(this,
|
|
||||||
sync == 'sync' ?
|
|
||||||
sync
|
|
||||||
: q,
|
|
||||||
...inputs))
|
|
||||||
|
|
||||||
// run...
|
// run...
|
||||||
return (inputs instanceof Promise
|
return (inputs instanceof Promise
|
||||||
|| inputs instanceof runner.FinalizableQueue) ?
|
|| inputs instanceof runner.FinalizableQueue) ?
|
||||||
|
|||||||
@ -755,23 +755,39 @@ var SharpActions = actions.Actions({
|
|||||||
//{quiet: true, pool_size: 2, busy_timeout_scale: 10},
|
//{quiet: true, pool_size: 2, busy_timeout_scale: 10},
|
||||||
// parse args...
|
// parse args...
|
||||||
function(queue, image, ...args){
|
function(queue, image, ...args){
|
||||||
|
var that = this
|
||||||
var force = false
|
var force = false
|
||||||
if(image === true){
|
if(image === true){
|
||||||
var [force, image, ...args] = arguments }
|
var [force, image, ...args] = arguments }
|
||||||
|
|
||||||
|
// expand images...
|
||||||
|
var images = image == 'all' ?
|
||||||
|
this.images.keys()
|
||||||
|
: image == 'loaded' ?
|
||||||
|
this.data.getImages('loaded')
|
||||||
|
: image instanceof Array ?
|
||||||
|
image
|
||||||
|
: [this.data.getImage(image || 'current')]
|
||||||
|
// narrow down the list...
|
||||||
|
images = force ?
|
||||||
|
images
|
||||||
|
: images
|
||||||
|
.filter(function(gid){
|
||||||
|
var img = that.images[gid]
|
||||||
|
return img
|
||||||
|
// high priority must be preset...
|
||||||
|
&& ((img.orientation == null
|
||||||
|
&& img.flipped == null)
|
||||||
|
// update metadata...
|
||||||
|
|| (img.metadata || {}).ImageGridMetadata == null) })
|
||||||
|
|
||||||
return [
|
return [
|
||||||
...(force ? [true] : []),
|
images,
|
||||||
// expand images..
|
force,
|
||||||
image == 'all' ?
|
|
||||||
this.images.keys()
|
|
||||||
: image == 'loaded' ?
|
|
||||||
this.data.getImages('loaded')
|
|
||||||
: (image || 'current'),
|
|
||||||
...args,
|
...args,
|
||||||
] },
|
] },
|
||||||
function(image, logger){
|
function(image, force, logger){
|
||||||
var that = this
|
var that = this
|
||||||
if(image === true){
|
|
||||||
var [force, image, logger] = arguments }
|
|
||||||
|
|
||||||
// XXX cache the image data???
|
// XXX cache the image data???
|
||||||
var gid = this.data.getImage(image)
|
var gid = this.data.getImage(image)
|
||||||
@ -886,9 +902,14 @@ module.Sharp = core.ImageGridFeatures.Feature({
|
|||||||
isApplicable: function(){ return !!sharp },
|
isApplicable: function(){ return !!sharp },
|
||||||
|
|
||||||
handlers: [
|
handlers: [
|
||||||
//* XXX this needs to be run in the background...
|
// NOTE: this is about as fast as filtering the images and
|
||||||
|
// calling only on the ones needing caching...
|
||||||
|
// ...but this is not a no-op, especially on very large
|
||||||
|
// indexes...
|
||||||
|
// XXX this needs to be run in the background...
|
||||||
// XXX this is best done in a thread
|
// XXX this is best done in a thread
|
||||||
[['loadImages',
|
[['loadIndex'
|
||||||
|
'loadImages',
|
||||||
'loadNewImages'],
|
'loadNewImages'],
|
||||||
'cacheMetadata: "all"'],
|
'cacheMetadata: "all"'],
|
||||||
//*/
|
//*/
|
||||||
@ -929,12 +950,7 @@ module.Sharp = core.ImageGridFeatures.Feature({
|
|||||||
that.ribbons.updateImage(gid)
|
that.ribbons.updateImage(gid)
|
||||||
|
|
||||||
// create the rest...
|
// create the rest...
|
||||||
that.makePreviews(gid)
|
that.makePreviews(gid) }) } }) } }]
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
//*/
|
//*/
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user