mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
still migrating to new glob...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cf048fb3cf
commit
69bbc872c6
@ -501,11 +501,11 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
|
|
||||||
// get the image list...
|
// get the image list...
|
||||||
return new Promise(function(resolve, reject){
|
return new Promise(function(resolve, reject){
|
||||||
glob(path + '/'+ that.config['image-file-pattern'], {
|
glob.globStream(path + '/'+ that.config['image-file-pattern'], {
|
||||||
stat: !!read_stat,
|
stat: !!read_stat,
|
||||||
strict: false,
|
strict: false,
|
||||||
})
|
})
|
||||||
.on('match', function(e){ found.push(e) })
|
.on('data', function(e){ found.push(e) })
|
||||||
.on('error', function(err){
|
.on('error', function(err){
|
||||||
update_interval
|
update_interval
|
||||||
&& clearInterval(update_interval)
|
&& clearInterval(update_interval)
|
||||||
|
|||||||
@ -64,13 +64,13 @@ function(paths, index_dir, logger){
|
|||||||
return paths.flat() }
|
return paths.flat() }
|
||||||
|
|
||||||
|
|
||||||
// Guarantee that the 'end' and 'match' handlers will always get called
|
// Guarantee that the 'end' and 'data' handlers will always get called
|
||||||
// with all results at least once...
|
// with all results at least once...
|
||||||
//
|
//
|
||||||
// This does two things:
|
// This does two things:
|
||||||
// - every 'end' event handler will get the full result set, regardless
|
// - every 'end' event handler will get the full result set, regardless
|
||||||
// of when it was set...
|
// of when it was set...
|
||||||
// - every 'match' handler will be called for every match found, again
|
// - every 'data' handler will be called for every match found, again
|
||||||
// regardless of whether it was set before or after the time of
|
// regardless of whether it was set before or after the time of
|
||||||
// match.
|
// match.
|
||||||
//
|
//
|
||||||
@ -78,13 +78,15 @@ function(paths, index_dir, logger){
|
|||||||
// essentially making it similar to how Promise/Deferred handle their
|
// essentially making it similar to how Promise/Deferred handle their
|
||||||
// callbacks.
|
// callbacks.
|
||||||
//
|
//
|
||||||
|
// XXX ASAP: end event arguments changed -- need to collect the list of
|
||||||
|
// matches manually...
|
||||||
var guaranteeGlobEvents =
|
var guaranteeGlobEvents =
|
||||||
module.guaranteeGlobEvents =
|
module.guaranteeGlobEvents =
|
||||||
function(glob){ return guaranteeEvents('match end', glob) }
|
function(glob){ return guaranteeEvents('data end', glob) }
|
||||||
|
|
||||||
var gGlob =
|
var gGlob =
|
||||||
module.gGlob = function(){
|
module.gGlob = function(){
|
||||||
return guaranteeGlobEvents(glob.apply(null, arguments)) }
|
return guaranteeGlobEvents(glob.globStream.apply(null, arguments)) }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -114,7 +116,7 @@ function(base, index_dir, logger){
|
|||||||
.on('error', function(err){
|
.on('error', function(err){
|
||||||
reject(err)
|
reject(err)
|
||||||
})
|
})
|
||||||
.on('match', function(path){
|
.on('data', function(path){
|
||||||
logger && logger.emit('found', path)
|
logger && logger.emit('found', path)
|
||||||
})
|
})
|
||||||
.on('end', function(paths){
|
.on('end', function(paths){
|
||||||
@ -681,7 +683,7 @@ function(base, pattern, previews, index_dir, absolute_path){
|
|||||||
//})
|
//})
|
||||||
// preview name syntax:
|
// preview name syntax:
|
||||||
// <res>px/<gid> - <orig-filename>.jpg
|
// <res>px/<gid> - <orig-filename>.jpg
|
||||||
.on('match', function(path){
|
.on('data', function(path){
|
||||||
// get the data we need...
|
// get the data we need...
|
||||||
var gid = pathlib.basename(path).split(' - ')[0]
|
var gid = pathlib.basename(path).split(' - ')[0]
|
||||||
var res = pathlib.basename(pathlib.dirname(path))
|
var res = pathlib.basename(pathlib.dirname(path))
|
||||||
@ -713,7 +715,7 @@ function(base, pattern, previews, index_dir, absolute_path){
|
|||||||
// XXX handle errors....
|
// XXX handle errors....
|
||||||
//.on('error', function(err){
|
//.on('error', function(err){
|
||||||
//})
|
//})
|
||||||
.on('match', function(base){
|
.on('data', function(base){
|
||||||
queue.push(loadPreviews(base, pattern, previews, index_dir, absolute_path))
|
queue.push(loadPreviews(base, pattern, previews, index_dir, absolute_path))
|
||||||
})
|
})
|
||||||
.on('end', function(){
|
.on('end', function(){
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user