mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
several tweaks and fixes...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
c750895a4a
commit
f05b8d74d2
@ -1969,7 +1969,6 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
//
|
//
|
||||||
// NOTE: with no arguments this will save index to .location.path
|
// NOTE: with no arguments this will save index to .location.path
|
||||||
//
|
//
|
||||||
// XXX should this return a promise??? ...a clean promise???
|
|
||||||
// XXX BUG: after .loadImages(..) and without arguments this produces
|
// XXX BUG: after .loadImages(..) and without arguments this produces
|
||||||
// a result that is not loaded....
|
// a result that is not loaded....
|
||||||
saveIndex: ['- File/',
|
saveIndex: ['- File/',
|
||||||
@ -2023,8 +2022,7 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
logger)
|
logger)
|
||||||
// set hidden file attribute on Windows...
|
// set hidden file attribute on Windows...
|
||||||
.then(function(){
|
.then(function(){
|
||||||
typeof(process) != 'undefined'
|
;(process.platform == 'win32'
|
||||||
&& (process.platform == 'win32'
|
|
||||||
|| process.platform == 'win64')
|
|| process.platform == 'win64')
|
||||||
&& child_process
|
&& child_process
|
||||||
.spawn('attrib', ['+h', full_path]) })
|
.spawn('attrib', ['+h', full_path]) })
|
||||||
|
|||||||
@ -248,12 +248,12 @@ var SharpActions = actions.Actions({
|
|||||||
core.sessionQueueHandler('Gathering image data for resizing',
|
core.sessionQueueHandler('Gathering image data for resizing',
|
||||||
// prepare the input index-dependant data in a fast way...
|
// prepare the input index-dependant data in a fast way...
|
||||||
function(queue, _, images, size, path, options){
|
function(queue, _, images, size, path, options){
|
||||||
var n = arguments.length - 1
|
var args = [...arguments].slice(2)
|
||||||
if(queue == 'sync'){
|
if(queue == 'sync'){
|
||||||
n--
|
args.unshift(_)
|
||||||
var [queue, images, size, path, options] = arguments }
|
var [images, size, path, options] = args }
|
||||||
// sanity check...
|
// sanity check...
|
||||||
if(n < 3){
|
if(args.length < 3){
|
||||||
throw new Error('.makeResizedImage(..): '
|
throw new Error('.makeResizedImage(..): '
|
||||||
+'need at least: images, size and path.') }
|
+'need at least: images, size and path.') }
|
||||||
return [
|
return [
|
||||||
@ -264,7 +264,7 @@ var SharpActions = actions.Actions({
|
|||||||
: images instanceof Array ?
|
: images instanceof Array ?
|
||||||
images
|
images
|
||||||
: [images],
|
: [images],
|
||||||
...[...arguments].slice(3),
|
...args.slice(1),
|
||||||
]},
|
]},
|
||||||
// prepare index independent data, this can be a tad slow...
|
// prepare index independent data, this can be a tad slow...
|
||||||
function(gid, size, path, options={}){
|
function(gid, size, path, options={}){
|
||||||
@ -415,6 +415,7 @@ var SharpActions = actions.Actions({
|
|||||||
|
|
||||||
// XXX this does not update image.base_path -- is this correct???
|
// XXX this does not update image.base_path -- is this correct???
|
||||||
// XXX add support for offloading the processing to a thread/worker...
|
// XXX add support for offloading the processing to a thread/worker...
|
||||||
|
// XXX make index dir hidden...
|
||||||
makePreviews: ['Sharp|File/Make image $previews',
|
makePreviews: ['Sharp|File/Make image $previews',
|
||||||
core.doc`Make image previews
|
core.doc`Make image previews
|
||||||
|
|
||||||
@ -482,8 +483,11 @@ var SharpActions = actions.Actions({
|
|||||||
} else {
|
} else {
|
||||||
sizes = cfg_sizes }
|
sizes = cfg_sizes }
|
||||||
|
|
||||||
|
// partially fill in the template...
|
||||||
|
var index_dir = this.config['index-dir'] || '.ImageGrid'
|
||||||
var path_tpl = that.config['preview-path-template']
|
var path_tpl = that.config['preview-path-template']
|
||||||
.replace(/\$INDEX|\$\{INDEX\}/g, this.config['index-dir'] || '.ImageGrid')
|
.replace(/\$INDEX|\$\{INDEX\}/g, index_dir)
|
||||||
|
var set_hidden_attrib = true
|
||||||
|
|
||||||
var img = this.images[gid]
|
var img = this.images[gid]
|
||||||
var base = base_path
|
var base = base_path
|
||||||
@ -497,6 +501,22 @@ var SharpActions = actions.Actions({
|
|||||||
.replace(/\$RESOLUTION|\$\{RESOLUTION\}/g, parseInt(size))
|
.replace(/\$RESOLUTION|\$\{RESOLUTION\}/g, parseInt(size))
|
||||||
.replace(/\$GID|\$\{GID\}/g, gid)
|
.replace(/\$GID|\$\{GID\}/g, gid)
|
||||||
.replace(/\$NAME|\$\{NAME\}/g, img.name)
|
.replace(/\$NAME|\$\{NAME\}/g, img.name)
|
||||||
|
|
||||||
|
// set the hidden flag on index dir...
|
||||||
|
// NOTE: this is done once per image...
|
||||||
|
// NOTE: we can't do this once per call as images can
|
||||||
|
// have different .base_path's...
|
||||||
|
set_hidden_attrib
|
||||||
|
&& (process.platform == 'win32'
|
||||||
|
|| process.platform == 'win64')
|
||||||
|
&& name.includes(index_dir)
|
||||||
|
&& cp.spawn('attrib', ['+h',
|
||||||
|
pathlib.resolve(
|
||||||
|
base,
|
||||||
|
name.split(index_dir)[0],
|
||||||
|
index_dir)])
|
||||||
|
set_hidden_attrib = false
|
||||||
|
|
||||||
// NOTE: we are 'sync' here for several reasons, mainly because
|
// NOTE: we are 'sync' here for several reasons, mainly because
|
||||||
// this is a small list and in this way we can take
|
// this is a small list and in this way we can take
|
||||||
// advantage of OS file caching, and removing the queue
|
// advantage of OS file caching, and removing the queue
|
||||||
@ -505,6 +525,7 @@ var SharpActions = actions.Actions({
|
|||||||
name,
|
name,
|
||||||
skipSmaller: true,
|
skipSmaller: true,
|
||||||
transform: false,
|
transform: false,
|
||||||
|
overwrite: false,
|
||||||
logger: logger_mode == 'gids' ?
|
logger: logger_mode == 'gids' ?
|
||||||
false
|
false
|
||||||
: logger,
|
: logger,
|
||||||
@ -520,8 +541,9 @@ var SharpActions = actions.Actions({
|
|||||||
&& that.markChanged('images', [gid]) }
|
&& that.markChanged('images', [gid]) }
|
||||||
return [gid, size, name] },
|
return [gid, size, name] },
|
||||||
function(err){
|
function(err){
|
||||||
// XXX error
|
// XXX erro
|
||||||
//logger && logger.emit('skipped', gid)
|
logger
|
||||||
|
&& logger.emit('skipped', `${gid} / ${size}`)
|
||||||
}) })) })],
|
}) })) })],
|
||||||
|
|
||||||
// XXX add support for offloading the processing to a thread/worker...
|
// XXX add support for offloading the processing to a thread/worker...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user