mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
moving .checkIndex(..) to queue...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
0e0fbcb7e3
commit
8e11308ed6
@ -853,6 +853,42 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
.then(function(res){
|
.then(function(res){
|
||||||
return res.flat() })
|
return res.flat() })
|
||||||
}],
|
}],
|
||||||
|
// XXX EXPERIMENTAL...
|
||||||
|
_checkIndex: ['File/Check index consistency',
|
||||||
|
// XXX technically this can be a non-session queue, but we'll
|
||||||
|
// need to save the check results...
|
||||||
|
// XXX update handlers...
|
||||||
|
core.sessionQueueHandler('checkIndex',
|
||||||
|
function(queue, ...args){
|
||||||
|
// no index loaded...
|
||||||
|
if(!this.location.loaded){
|
||||||
|
// XXX should this throw or resolve???
|
||||||
|
throw new Error('.checkIndex(): no index to fix.') }
|
||||||
|
// merged index...
|
||||||
|
// XXX can we remove this restriction -- i.e. check each index...
|
||||||
|
if(this.location.loaded.length > 1){
|
||||||
|
throw new Error('.checkIndex(): combined indexes not supported.') }
|
||||||
|
// get the data...
|
||||||
|
return [Object.entries(this.images), ...args] },
|
||||||
|
// XXX test...
|
||||||
|
function([gid, image], ...args){
|
||||||
|
var updated = false
|
||||||
|
// image .previews...
|
||||||
|
var previews = image.preview || {}
|
||||||
|
Object.entries(previews)
|
||||||
|
.forEach(function(p){
|
||||||
|
!fse.existsSync(image.base_path +'/'+ p[1])
|
||||||
|
&& (updated = true)
|
||||||
|
&& (delete previews[p[0]]) })
|
||||||
|
// image .path...
|
||||||
|
!fse.existsSync(image.base_path +'/'+ image.path)
|
||||||
|
&& (updated = true)
|
||||||
|
&& (delete image.path)
|
||||||
|
|
||||||
|
// XXX check return values...
|
||||||
|
return updated ?
|
||||||
|
gid
|
||||||
|
: [] })],
|
||||||
|
|
||||||
// XXX should this take a path argument???
|
// XXX should this take a path argument???
|
||||||
// XXX not yet sure about this...
|
// XXX not yet sure about this...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user