Re-load continues processing correctly
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
7fb65d04d5
commit
88e3a284b7
@ -202,8 +202,8 @@ function processBlock(items) {
|
||||
});
|
||||
|
||||
let toProcess = processing.length, lastMessage = moment();
|
||||
console.log("Hash items to be processed: " + toProcess);
|
||||
return Promise.map(processing, function(asset) {
|
||||
console.log("Items to be processed: " + toProcess);
|
||||
return Promise.mapSeries(processing, function(asset) {
|
||||
return computeHash(picturesPath + asset.album.path + asset.filename).then(function(hash) {
|
||||
asset.hash = hash;
|
||||
return asset;
|
||||
@ -226,7 +226,7 @@ function processBlock(items) {
|
||||
"'" + asset.album.path + asset.filename + "' is a copy of " +
|
||||
"'" + results[0].path + results[0].filename + "'");
|
||||
duplicates.push(asset);
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
|
||||
/* Even if the hash doesn't need to be updated, the entry needs to be scanned */
|
||||
@ -241,23 +241,12 @@ function processBlock(items) {
|
||||
}).then(function() {
|
||||
return asset;
|
||||
});
|
||||
}).then(function() {
|
||||
toProcess--;
|
||||
if (moment().add(-5, 'seconds') > lastMessage) {
|
||||
console.log("Hash items to be processed: " + toProcess);
|
||||
lastMessage = moment();
|
||||
}
|
||||
});
|
||||
});
|
||||
}, {
|
||||
concurrency: 5
|
||||
}).catch(function(error) {
|
||||
console.log("Error commiting HASH transactions");
|
||||
throw error;
|
||||
}).then(function() {
|
||||
let toProcess = needsProcessing.length, lastMessage = moment();
|
||||
console.log(needsProcessing.length + " assets need to have metadata extracted");
|
||||
return Promise.map(needsProcessing, function(asset) {
|
||||
}).then(function(asset) {
|
||||
if (!asset) { /* The processed entry is a DUPLICATE. Skip it. */
|
||||
return;
|
||||
}
|
||||
|
||||
var path = asset.album.path,
|
||||
file = asset.filename,
|
||||
created = asset.stats.mtime,
|
||||
@ -364,12 +353,6 @@ function processBlock(items) {
|
||||
"WHERE id=:id", {
|
||||
replacements: asset,
|
||||
});
|
||||
}).then(function() {
|
||||
toProcess--;
|
||||
if (moment().add(-5, 'seconds') > lastMessage) {
|
||||
console.log("Items to be processed: " + toProcess);
|
||||
lastMessage = moment();
|
||||
}
|
||||
});
|
||||
}).catch(function(error) {
|
||||
console.error("Error reading image " + src + ": ", error);
|
||||
@ -399,9 +382,16 @@ function processBlock(items) {
|
||||
}).catch(function() {
|
||||
console.warn("Continuing file processing.");
|
||||
});
|
||||
}, {
|
||||
concurrency: 5
|
||||
}).then(function() {
|
||||
toProcess--;
|
||||
if (moment().add(-5, 'seconds') > lastMessage) {
|
||||
console.log("Items to be processed: " + toProcess);
|
||||
lastMessage = moment();
|
||||
}
|
||||
});
|
||||
}).catch(function(error) {
|
||||
console.log("Error processing file. Continuing.");
|
||||
throw error;
|
||||
}).then(function() {
|
||||
console.log("Completed processing queue. Marking " + duplicates.length + " duplicates.");
|
||||
let dups = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user