several fixes + docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-11-06 02:25:55 +03:00
parent baa1b06dce
commit d5771925c4

View File

@ -259,7 +259,7 @@ var SharpActions = actions.Actions({
abort.cleanup(function(reason, res){ abort.cleanup(function(reason, res){
logger logger
&& logger.emit('close') && logger.emit('done')
&& reason == 'aborted' && reason == 'aborted'
&& logger.emit(res) }) && logger.emit(res) })
@ -448,8 +448,12 @@ var SharpActions = actions.Actions({
var CHUNK_SIZE = 4 var CHUNK_SIZE = 4
abort.cleanup(function(reason, res){ abort.cleanup(function(reason, res){
gid_logger
&& gid_logger.emit('done')
&& reason == 'aborted'
&& gid_logger.emit(res)
logger logger
&& logger.emit('close') && logger.emit('done')
&& reason == 'aborted' && reason == 'aborted'
&& logger.emit(res) }) && logger.emit(res) })
@ -461,7 +465,6 @@ var SharpActions = actions.Actions({
logger = logger && logger.push('Previews', {onclose: abort}) logger = logger && logger.push('Previews', {onclose: abort})
// get/normalize images... // get/normalize images...
//images = images || this.current
images = images images = images
|| 'all' || 'all'
// keywords... // keywords...
@ -494,6 +497,8 @@ var SharpActions = actions.Actions({
var path_tpl = that.config['preview-path-template'] var path_tpl = that.config['preview-path-template']
.replace(/\$INDEX|\$\{INDEX\}/g, that.config['index-dir'] || '.ImageGrid') .replace(/\$INDEX|\$\{INDEX\}/g, that.config['index-dir'] || '.ImageGrid')
gid_logger && gid_logger.emit('queued', images)
return images return images
.mapChunks(CHUNK_SIZE, function(gid){ .mapChunks(CHUNK_SIZE, function(gid){
if(abort.isAborted){ if(abort.isAborted){
@ -504,8 +509,6 @@ var SharpActions = actions.Actions({
|| img.base_path || img.base_path
|| that.location.path || that.location.path
gid_logger && gid_logger.emit('queued', gid)
return sizes return sizes
.map(function(size, i){ .map(function(size, i){
if(abort.isAborted){ if(abort.isAborted){
@ -575,8 +578,10 @@ var SharpActions = actions.Actions({
-> promise([ gid | null, .. ]) -> promise([ gid | null, .. ])
This quickly reads/caches essential (.orientation and .flipped) This will:
metadata and some non-essential but already there values. - quickly reads/caches essential (.orientation and .flipped) metadata
- quickly read some non-essential but already there values
- generate priority previews for very large images (only when in index)
This will overwrite/update if: This will overwrite/update if:
@ -597,7 +602,7 @@ var SharpActions = actions.Actions({
abort.cleanup(function(reason, res){ abort.cleanup(function(reason, res){
logger logger
&& logger.emit('close') && logger.emit('done')
&& reason == 'aborted' && reason == 'aborted'
&& logger.emit(res) && logger.emit(res)
delete that.__cache_metadata_reading }) delete that.__cache_metadata_reading })
@ -768,7 +773,6 @@ var SharpActions = actions.Actions({
}) })
// XXX need to auto-generate previews for very large images...
var Sharp = var Sharp =
module.Sharp = core.ImageGridFeatures.Feature({ module.Sharp = core.ImageGridFeatures.Feature({
title: '', title: '',