diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index e4acae62..12c2e129 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -599,6 +599,8 @@ module.SortActions = actions.Actions({ // } // // NOTE: the cmp function is called in the actions context. + // + // XXX sequence number with overflow... __sort_methods__: { 'name-leading-sequence': function(a, b){ a = this.images.getImageNameLeadingSeq(a) @@ -657,9 +659,14 @@ module.SortActions = actions.Actions({ // will reverse the result's order while: // 'metadata.createDate birthtime reverse' + ' reverese' // will cancel reversal. + // NOTE: with empty images this will not do anything. // - // XXX this also requires images... // XXX cache order??? + // XXX would be nice to be able to sort a list of gids or a section + // of images... + // XXX sorting with partial images will throw the images that do not + // exist or the ones that do not have the right attrs all over + // the place... sortImages: ['- Edit|Sort/Sort images', function(method, reverse){ var that = this @@ -692,7 +699,6 @@ module.SortActions = actions.Actions({ .join(' ') : method method = typeof(method) == typeof('str') ? method.split(/ +/g) : method - method = method instanceof Array ? method : [method] // get the reverse arity... var i = method.indexOf('reverse') @@ -808,8 +814,8 @@ module.SortActions = actions.Actions({ })], // Store/load sort data: - // .data.sort_method - current sort mode (optional) - // .manual_order - manual sort order (optional) + // .data.sort_method - current sort mode (optional) + // .data.manual_order - manual sort order (optional) load: [function(data){ return function(){ if(data.data && data.data.sort_method){ diff --git a/ui (gen4)/features/cli.js b/ui (gen4)/features/cli.js index 9d42a3a9..30558826 100755 --- a/ui (gen4)/features/cli.js +++ b/ui (gen4)/features/cli.js @@ -141,6 +141,9 @@ module.CLI = core.ImageGridFeatures.Feature({ }) */ + // XXX might be a good idea to make the action call + // syntax like this: + // -- [args] .arguments(' [args]') .action(function(action, args){ // XXX diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index 514141d1..6c5bdbf3 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -270,6 +270,7 @@ var FileSystemLoaderActions = actions.Actions({ // XXX auto-detect format or let the user chose... // XXX should this return a promise??? ...a clean promise??? + // XXX should the added section be marked or sorted??? loadPath: ['- File/Load path (STUB)', function(path, logger){ // XXX check if this.config['index-dir'] exists, if yes then @@ -278,8 +279,6 @@ var FileSystemLoaderActions = actions.Actions({ //this.location.method = 'loadImages' }], - // XXX merging does not work (something wrong with .data.join(..)) - // ...fixed a bug in images.js hash generator, now might be fixed... // XXX should this return a promise??? ...a clean promise??? // XXX revise logger... loadNewImages: ['File/Load new images', @@ -298,8 +297,11 @@ var FileSystemLoaderActions = actions.Actions({ var base_pattern = RegExp('^'+path) // find images... - glob(path + '/'+ this.config['image-file-pattern']) + glob(path + '/'+ this.config['image-file-pattern'], + {stat: !!this.config['image-file-read-stat']}) .on('end', function(lst){ + var stats = this.statCache + // create a new images chunk... lst = lst // filter out loaded images... @@ -327,6 +329,19 @@ var FileSystemLoaderActions = actions.Actions({ var gids = new_images.keys() var new_data = that.data.constructor.fromArray(gids) + new_images.forEach(function(gid, img){ + var stat = stats[p.join(img.base_path, img.path)] + + img.atime = stat.atime + img.mtime = stat.mtime + img.ctime = stat.ctime + img.birthtime = stat.birthtime + + img.size = stat.size + + // XXX do we need anything else??? + }) + // merge with index... // NOTE: we are prepending new images to the start... // NOTE: all ribbon gids will change here... diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 6c9ffdc8..2f649537 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -168,6 +168,8 @@ module.GLOBAL_KEYBOARD = { // XXX need to prevent default on mac + browser... meta: 'nextScreen', }, + Space: 'Right', + Backspace: 'Left', '(': 'prevImageInOrder', ')': 'nextImageInOrder', ',': 'prevMarked', diff --git a/ui (gen4)/features/metadata.js b/ui (gen4)/features/metadata.js index efb3a7fe..ac2bbac0 100755 --- a/ui (gen4)/features/metadata.js +++ b/ui (gen4)/features/metadata.js @@ -90,6 +90,8 @@ module.Metadata = core.ImageGridFeatures.Feature({ // XXX add Metadata writer... var MetadataReaderActions = actions.Actions({ + // NOTE: this will read both stat and metadata... + // // XXX add support to taskqueue... // XXX should this process multiple images??? // XXX also check the metadata/ folder (???) @@ -119,6 +121,20 @@ var MetadataReaderActions = actions.Actions({ return reject(err) } + // read stat... + if(!that.images[gid].birthtime){ + var img = that.images[gid] + var stat = fs.statSync(full_path) + + img.atime = stat.atime + img.mtime = stat.mtime + img.ctime = stat.ctime + img.birthtime = stat.birthtime + + img.size = stat.size + } + + // read image metadata... exiftool.metadata(file, function(err, data){ if(err){ reject(err)