some polishing of exporting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-07-01 18:25:33 +04:00
parent bb413be06b
commit b9c22d7781
2 changed files with 19 additions and 3 deletions

View File

@ -557,6 +557,9 @@ function updateRibbonsFromFavDirs(){
// Export current state to directory...
//
// XXX this copies the files in parallel, make it sync and sequential...
// ...reason is simple, if we stop the copy we need to end up with
// part of the files copied full rather than all partially...
function exportTo(path, im_name, dir_name, size){
path = path == null ? BASE_URL : path
im_name = im_name == null ? '%f' : im_name
@ -570,7 +573,16 @@ function exportTo(path, im_name, dir_name, size){
path = normalizePath(path)
var order = DATA.order
var z = (('10e' + (order.length + '').length) * 1 + '').slice(2)
var Z = (('10e' + (order.length + '').length) * 1 + '').slice(2)
// mainly used for file naming, gives us ability to number images
// in the current selection...
var selection = []
$.each(DATA.ribbons, function(_, e){
selection = selection.concat(e)
})
selection.sort(imageOrderCmp)
var z = (('10e' + (selection.length + '').length) * 1 + '').slice(2)
// go through ribbons...
for(var i=DATA.ribbons.length-1; i >= 0; i--){
@ -593,8 +605,11 @@ function exportTo(path, im_name, dir_name, size){
// gid...
dest = dest.replace('%gid', gid)
dest = dest.replace('%g', gid.slice(34))
// order...
// global order...
var o = order.indexOf(gid) + ''
dest = dest.replace('%I', (Z + o).slice(o.length))
//
var o = selection.indexOf(gid) + ''
dest = dest.replace('%i', (z + o).slice(o.length))
// XXX Metadata...
// XXX

View File

@ -728,7 +728,8 @@ function exportPreviewsDialog(state, dfl){
'%e - extension\n'+
'%gid - log gid\n'+
'%g - short gid\n'+
'%i - order'] = '%f'
'%I - global order\n'+
'%i - current selection order'] = '%f'
cfg['Fav directory name'] = 'fav'
cfg['Destination'] = {ndir: dfl}