mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 19:00:09 +00:00
added gid generation on raw dirs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
4a01b8b39d
commit
5fcc0be02a
31
ui/files.js
31
ui/files.js
@ -757,10 +757,11 @@ function loadRawDir(path, no_preview_processing, prefix){
|
|||||||
setBaseURL(path)
|
setBaseURL(path)
|
||||||
|
|
||||||
IMAGES = imagesFromUrls(image_paths)
|
IMAGES = imagesFromUrls(image_paths)
|
||||||
res.notify(prefix, 'Loaded', 'Images.')
|
|
||||||
IMAGES_CREATED = true
|
IMAGES_CREATED = true
|
||||||
|
res.notify(prefix, 'Loaded', 'Images.')
|
||||||
|
|
||||||
DATA = dataFromImages(IMAGES)
|
DATA = dataFromImages(IMAGES)
|
||||||
|
dataUpdated()
|
||||||
res.notify(prefix, 'Loaded', 'Data.')
|
res.notify(prefix, 'Loaded', 'Data.')
|
||||||
|
|
||||||
// XXX this will reload viewer...
|
// XXX this will reload viewer...
|
||||||
@ -776,7 +777,11 @@ function loadRawDir(path, no_preview_processing, prefix){
|
|||||||
res.notify(prefix, 'Loading', 'Images metadata.')
|
res.notify(prefix, 'Loading', 'Images metadata.')
|
||||||
var o = $.when(
|
var o = $.when(
|
||||||
readImagesOrientationQ(),
|
readImagesOrientationQ(),
|
||||||
readImagesDatesQ()
|
readImagesDatesQ(),
|
||||||
|
// XXX this is still experimental...
|
||||||
|
// ...not sure if this will not cause race conditions with
|
||||||
|
// the other readers...
|
||||||
|
updateImagesGIDsQ()
|
||||||
)
|
)
|
||||||
.done(function(){
|
.done(function(){
|
||||||
res.notify(prefix, 'Loaded', 'Images metadata.')
|
res.notify(prefix, 'Loaded', 'Images metadata.')
|
||||||
@ -941,6 +946,7 @@ function updateRibbonsFromFavDirs(){
|
|||||||
DATA.ribbons = ribbonsFromFavDirs(null, null, imageOrderCmp)
|
DATA.ribbons = ribbonsFromFavDirs(null, null, imageOrderCmp)
|
||||||
sortImagesByDate()
|
sortImagesByDate()
|
||||||
reloadViewer()
|
reloadViewer()
|
||||||
|
dataUpdated()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1155,12 +1161,19 @@ function readImagesDatesQ(images){
|
|||||||
// XXX deleting images is not sported, we need to explicitly re-save...
|
// XXX deleting images is not sported, we need to explicitly re-save...
|
||||||
// XXX need to reload the viewer...
|
// XXX need to reload the viewer...
|
||||||
// XXX not tested...
|
// XXX not tested...
|
||||||
|
// XXX need to also replace in MARKED, BOOKMARKS, ...
|
||||||
|
// ...and make it systematic...
|
||||||
function updateImageGID(gid, images, data){
|
function updateImageGID(gid, images, data){
|
||||||
|
gid = gid == null ? getImageGID() : gid
|
||||||
images = images == null ? IMAGES : images
|
images = images == null ? IMAGES : images
|
||||||
|
data = data == null ? DATA : data
|
||||||
var img = images[gid]
|
var img = images[gid]
|
||||||
|
var key = gid
|
||||||
|
|
||||||
return getEXIFGID(normalizePath(img.path))
|
return getEXIFGID(normalizePath(img.path))
|
||||||
.done(function(gid){
|
.done(function(gid){
|
||||||
img.id = gid
|
img.id = gid
|
||||||
|
|
||||||
// images...
|
// images...
|
||||||
images[gid] = images[key]
|
images[gid] = images[key]
|
||||||
delete images[key]
|
delete images[key]
|
||||||
@ -1175,13 +1188,21 @@ function updateImageGID(gid, images, data){
|
|||||||
// replace in order...
|
// replace in order...
|
||||||
data.order[data.order.indexOf(key)] = gid
|
data.order[data.order.indexOf(key)] = gid
|
||||||
// replace in ribbons...
|
// replace in ribbons...
|
||||||
for(var i=0; i < data.ribbons; i++){
|
for(var i=0; i < data.ribbons.length; i++){
|
||||||
var r = data.ribbons[i]
|
var r = data.ribbons[i]
|
||||||
var k = r.indexOf(key)
|
var k = r.indexOf(key)
|
||||||
if(k >= 0){
|
if(k >= 0){
|
||||||
r[k] = gid
|
r[k] = gid
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dataUpdated()
|
||||||
|
}
|
||||||
|
|
||||||
|
// update the actual image...
|
||||||
|
var i = getImage(key)
|
||||||
|
if(i.length > 0){
|
||||||
|
updateImage(i, gid)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@ -1197,13 +1218,15 @@ function updateImagesGIDsQ(images, data){
|
|||||||
|
|
||||||
var queue = getWorkerQueue('Update GIDs', 4)
|
var queue = getWorkerQueue('Update GIDs', 4)
|
||||||
|
|
||||||
$.each(images, function(_, key){
|
$.each(images, function(key){
|
||||||
queue.enqueue(updateImageGID, key, images, data)
|
queue.enqueue(updateImageGID, key, images, data)
|
||||||
.always(function(){
|
.always(function(){
|
||||||
//queue.notify(key, 'done')
|
//queue.notify(key, 'done')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
IMAGES_CREATED = true
|
||||||
|
|
||||||
return queue
|
return queue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user