mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
finished migration to new glob...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
250869530f
commit
3fd43123ba
@ -501,17 +501,26 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
|
|
||||||
// get the image list...
|
// get the image list...
|
||||||
return new Promise(function(resolve, reject){
|
return new Promise(function(resolve, reject){
|
||||||
|
var files = {}
|
||||||
glob.globStream(path + '/'+ that.config['image-file-pattern'], {
|
glob.globStream(path + '/'+ that.config['image-file-pattern'], {
|
||||||
stat: !!read_stat,
|
stat: !!read_stat,
|
||||||
|
withFileTypes: true,
|
||||||
strict: false,
|
strict: false,
|
||||||
})
|
})
|
||||||
.on('data', function(e){ found.push(e) })
|
.on('data', function(e){
|
||||||
|
var p = e.fullpath()
|
||||||
|
// normalize win paths...
|
||||||
|
.replace(/\\/g, '/')
|
||||||
|
files[p] = e
|
||||||
|
found.push(p) })
|
||||||
.on('error', function(err){
|
.on('error', function(err){
|
||||||
update_interval
|
update_interval
|
||||||
&& clearInterval(update_interval)
|
&& clearInterval(update_interval)
|
||||||
console.error(err)
|
console.error(err)
|
||||||
reject(err) })
|
reject(err) })
|
||||||
.on('end', function(lst){
|
.on('end', function(){
|
||||||
|
// XXX do we need to have two copies of the list???
|
||||||
|
var lst = found.slice()
|
||||||
update_interval
|
update_interval
|
||||||
&& clearInterval(update_interval)
|
&& clearInterval(update_interval)
|
||||||
logger && found.length > 0
|
logger && found.length > 0
|
||||||
@ -526,11 +535,13 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
var imgs = images.Images.fromArray(lst, path)
|
var imgs = images.Images.fromArray(lst, path)
|
||||||
|
|
||||||
if(!!read_stat){
|
if(!!read_stat){
|
||||||
var stats = this.statCache
|
|
||||||
var p = pathlib.posix
|
var p = pathlib.posix
|
||||||
|
|
||||||
imgs.forEach(function(gid, img){
|
imgs.forEach(function(gid, img){
|
||||||
var stat = stats[p.join(img.base_path, img.path)]
|
var stat = files[
|
||||||
|
img.base_path ?
|
||||||
|
p.join(img.base_path, img.path)
|
||||||
|
: img.path]
|
||||||
|
|
||||||
img.atime = stat.atime
|
img.atime = stat.atime
|
||||||
img.mtime = stat.mtime
|
img.mtime = stat.mtime
|
||||||
@ -1203,7 +1214,8 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
browseImages: ['- File/Load images...', makeBrowseProxy('loadImages')],
|
browseImages: ['- File/Load images...', makeBrowseProxy('loadImages')],
|
||||||
|
|
||||||
browseSubIndexes: ['File/List sub-indexes...',
|
browseSubIndexes: ['File/List sub-indexes...',
|
||||||
widgets.makeUIDialog(function(){
|
widgets
|
||||||
|
.makeUIDialog(function(){
|
||||||
var that = this
|
var that = this
|
||||||
var index_dir = this.config['index-dir']
|
var index_dir = this.config['index-dir']
|
||||||
|
|
||||||
@ -1213,8 +1225,7 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
|
|
||||||
if(that.location.load != 'loadIndex'){
|
if(that.location.load != 'loadIndex'){
|
||||||
make('No indexes loaded...', null, true)
|
make('No indexes loaded...', null, true)
|
||||||
return
|
return }
|
||||||
}
|
|
||||||
|
|
||||||
// indicate that we are working...
|
// indicate that we are working...
|
||||||
var spinner = make('...')
|
var spinner = make('...')
|
||||||
@ -1222,12 +1233,13 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
// XXX we do not need to actually read anything....
|
// XXX we do not need to actually read anything....
|
||||||
//file.loadIndex(path, that.config['index-dir'], this.logger)
|
//file.loadIndex(path, that.config['index-dir'], this.logger)
|
||||||
// XXX we need to prune the indexes -- avoid loading nested indexes...
|
// XXX we need to prune the indexes -- avoid loading nested indexes...
|
||||||
|
var res = []
|
||||||
file.listIndexes(path, index_dir)
|
file.listIndexes(path, index_dir)
|
||||||
.on('error', function(err){
|
.on('error', function(err){
|
||||||
console.error(err)
|
console.error(err) })
|
||||||
})
|
.on('data', function(path){
|
||||||
.on('end', function(res){
|
res.push(path) })
|
||||||
|
.on('end', function(){
|
||||||
// we got the data, we can now remove the spinner...
|
// we got the data, we can now remove the spinner...
|
||||||
spinner.remove()
|
spinner.remove()
|
||||||
|
|
||||||
@ -1242,9 +1254,7 @@ var FileSystemLoaderUIActions = actions.Actions({
|
|||||||
that.loadIndex(p) }) }) }) })
|
that.loadIndex(p) }) }) }) })
|
||||||
.on('open', function(){
|
.on('open', function(){
|
||||||
o.close() })
|
o.close() })
|
||||||
|
return o })],
|
||||||
return o
|
|
||||||
})],
|
|
||||||
|
|
||||||
toggleDotFileDrawing: ['Interface/File browser/Hide dot files',
|
toggleDotFileDrawing: ['Interface/File browser/Hide dot files',
|
||||||
core.makeConfigToggler(
|
core.makeConfigToggler(
|
||||||
|
|||||||
@ -25,7 +25,7 @@ if(typeof(process) != 'undefined'){
|
|||||||
var cp = requirejs('child_process')
|
var cp = requirejs('child_process')
|
||||||
var fse = requirejs('fs-extra')
|
var fse = requirejs('fs-extra')
|
||||||
var pathlib = requirejs('path')
|
var pathlib = requirejs('path')
|
||||||
var glob = requirejs('glob')
|
//var glob = requirejs('glob')
|
||||||
// XXX migrate to exifreader as it is a bit more flexible...
|
// XXX migrate to exifreader as it is a bit more flexible...
|
||||||
// ...use it in browser mode...
|
// ...use it in browser mode...
|
||||||
//var exifReader = requirejs('exifreader')
|
//var exifReader = requirejs('exifreader')
|
||||||
|
|||||||
@ -321,7 +321,9 @@ module.ImagesClassPrototype = {
|
|||||||
// XXX stub...
|
// XXX stub...
|
||||||
var i = 0
|
var i = 0
|
||||||
//var base_pattern = base ? RegExp('^' + base) : null
|
//var base_pattern = base ? RegExp('^' + base) : null
|
||||||
var base_pattern = base ? RegExp('^' + RegExp.quoteRegExp(base)) : null
|
var base_pattern = base ?
|
||||||
|
RegExp('^' + RegExp.quoteRegExp(base))
|
||||||
|
: null
|
||||||
data.forEach(function(path){
|
data.forEach(function(path){
|
||||||
// XXX need to normalize path...
|
// XXX need to normalize path...
|
||||||
var p = path.startsWith('data') ?
|
var p = path.startsWith('data') ?
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "ImageGrid.Viewer.g4",
|
"name": "ImageGrid.Viewer.g4",
|
||||||
"main": "index.html",
|
"main": "index.html",
|
||||||
"version": "4.0.6a",
|
"version": "4.0.7a",
|
||||||
"author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)",
|
"author": "Alex A. Naanou <alex.nanou@gmail.com> (https://github.com/flynx)",
|
||||||
"contributors": [],
|
"contributors": [],
|
||||||
"repository": "github:flynx/ImageGrid",
|
"repository": "github:flynx/ImageGrid",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user