mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
rethinking the fs module...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
64095d10b5
commit
26f9c46105
@ -2097,6 +2097,9 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
|
|||||||
})
|
})
|
||||||
}],
|
}],
|
||||||
// load collection local tags from .data.tags to .local_tags...
|
// load collection local tags from .data.tags to .local_tags...
|
||||||
|
// ...this is needed if the collections are fully loaded as part
|
||||||
|
// of the index...
|
||||||
|
// XXX do we actually need this???
|
||||||
['load',
|
['load',
|
||||||
function(_, json){
|
function(_, json){
|
||||||
var that = this
|
var that = this
|
||||||
@ -2109,17 +2112,17 @@ module.CollectionTags = core.ImageGridFeatures.Feature({
|
|||||||
// do the loading...
|
// do the loading...
|
||||||
.forEach(function(title){
|
.forEach(function(title){
|
||||||
var c = that.collections[title]
|
var c = that.collections[title]
|
||||||
if(!c){
|
|
||||||
|
if(!c || !c.data){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
var t = (c.data || {}).tags || {}
|
|
||||||
|
|
||||||
/* XXX do we need this???
|
var t = (c.data.tags || {}).tags || {}
|
||||||
c.local_tags = c.local_tags || {}
|
var lt = c.local_tags = c.local_tags || {}
|
||||||
|
|
||||||
;(that.config['collection-local-tags'] || [])
|
;(that.config['collection-local-tags'] || [])
|
||||||
.forEach(function(tag){
|
.forEach(function(tag){
|
||||||
c.local_tags[tag] = new Set(c.local_tags[tag] || t[tag] || []) })
|
lt[tag] = new Set(lt[tag] || t[tag] || []) })
|
||||||
//*/
|
|
||||||
})
|
})
|
||||||
}],
|
}],
|
||||||
],
|
],
|
||||||
|
|||||||
@ -1038,7 +1038,7 @@ var CommentsActions = actions.Actions({
|
|||||||
// ...
|
// ...
|
||||||
// },
|
// },
|
||||||
//
|
//
|
||||||
// <keywork>: <data>,
|
// <keyword>: <data>,
|
||||||
// ...
|
// ...
|
||||||
// }
|
// }
|
||||||
__comments: null,
|
__comments: null,
|
||||||
@ -1158,22 +1158,24 @@ var FileSystemCommentsActions = actions.Actions({
|
|||||||
return Promise.all(loaded.map(function(path){
|
return Promise.all(loaded.map(function(path){
|
||||||
var comments_dir = that.config['index-dir'] +'/comments'
|
var comments_dir = that.config['index-dir'] +'/comments'
|
||||||
|
|
||||||
return file.loadIndex(path, that.config['index-dir'] +'/comments', date, logger)
|
return file.loadIndex(path +'/'+ comments_dir, false, date, logger)
|
||||||
.then(function(res){
|
.then(function(res){
|
||||||
|
var c = res[path +'/'+ comments_dir]
|
||||||
|
|
||||||
// no comments present...
|
// no comments present...
|
||||||
if(res[path] == null){
|
if(c == null){
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we have no sub-indexes just load the
|
// if we have no sub-indexes just load the
|
||||||
// comments as-is...
|
// comments as-is...
|
||||||
if(loaded.length == 1){
|
if(loaded.length == 1){
|
||||||
that.comments = JSON.parse(JSON.stringify(res[path]))
|
that.comments = JSON.parse(JSON.stringify(c))
|
||||||
that.comments.raw = {path: res[path]}
|
that.comments.raw = {path: c}
|
||||||
|
|
||||||
// sub-indexes -> let the client merge their stuff...
|
// sub-indexes -> let the client merge their stuff...
|
||||||
} else {
|
} else {
|
||||||
that.comments.raw[path] = res[path]
|
that.comments.raw[path] = c
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
@ -1287,9 +1289,19 @@ var FileSystemSaveHistoryActions = actions.Actions({
|
|||||||
|
|
||||||
loadSaveHistoryList: ['- File/',
|
loadSaveHistoryList: ['- File/',
|
||||||
function(path){
|
function(path){
|
||||||
path = path || this.location.path
|
var index_dir = this.config['index-dir']
|
||||||
|
path = path || this.location.loaded
|
||||||
|
path = path instanceof Array ? path : [path]
|
||||||
|
|
||||||
return file.loadSaveHistoryList(path)
|
var res = {}
|
||||||
|
return Promise
|
||||||
|
.all(this.location.loaded
|
||||||
|
.map(function(path){
|
||||||
|
return file.loadSaveHistoryList(path +'/'+ index_dir)
|
||||||
|
.then(function(data){
|
||||||
|
res[path] = data }) }))
|
||||||
|
.then(function(){
|
||||||
|
return res })
|
||||||
}],
|
}],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -177,8 +177,9 @@ core.ImageGridFeatures.Feature('imagegrid-testing', [
|
|||||||
//----------------------------------------------------- testing ---
|
//----------------------------------------------------- testing ---
|
||||||
'experiments',
|
'experiments',
|
||||||
'-tests',
|
'-tests',
|
||||||
|
|
||||||
// XXX this is really slow on load, need to speed the search up...
|
// XXX this is really slow on load, need to speed the search up...
|
||||||
'-comments',
|
//'-comments',
|
||||||
|
|
||||||
// missing suggested feature test -- should show up in .features.missing...
|
// missing suggested feature test -- should show up in .features.missing...
|
||||||
'missing-feature',
|
'missing-feature',
|
||||||
|
|||||||
@ -354,6 +354,8 @@ function(path, index_dir, logger){
|
|||||||
.on('end', function(files){
|
.on('end', function(files){
|
||||||
var data = groupByDate(files)
|
var data = groupByDate(files)
|
||||||
|
|
||||||
|
console.log('>>>>>', data)
|
||||||
|
|
||||||
// XXX should we mark the root timestamp in any way???
|
// XXX should we mark the root timestamp in any way???
|
||||||
if('root' in data && data.root.length > 0){
|
if('root' in data && data.root.length > 0){
|
||||||
// XXX handle stat error...
|
// XXX handle stat error...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user