Rename thumbs and scaled on image action=rename

Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
James Ketr 2018-10-20 18:30:02 -07:00
parent 1c43f2527e
commit 501657031c
2 changed files with 5 additions and 1 deletions

View File

@ -147,6 +147,10 @@ router.put("/:id", function(req, res/*, next*/) {
asset.filename = asset.filename.replace(/(\.[^.]*)$/, "-" + asset.hash.substring(0, 8) + "$1"); asset.filename = asset.filename.replace(/(\.[^.]*)$/, "-" + asset.hash.substring(0, 8) + "$1");
return rename(picturesPath + asset.path + src, picturesPath + asset.path + asset.filename).then(function() { return rename(picturesPath + asset.path + src, picturesPath + asset.path + asset.filename).then(function() {
return rename(picturesPath + asset.path + "thumbs/" + src, picturesPath + asset.path + "thumbs/" + asset.filename);
}).then(function() {
return rename(picturesPath + asset.path + src, picturesPath + "thumbs/scaled/" + asset.path + "thumbs/scaled/" + asset.filename);
}).then(function() {
return photoDB.sequelize.query("UPDATE photos SET filename=:filename WHERE id=:id", { return photoDB.sequelize.query("UPDATE photos SET filename=:filename WHERE id=:id", {
replacements: asset replacements: asset
}).then(function() { }).then(function() {

View File

@ -746,7 +746,7 @@ function doScan() {
let remaining = assets.length - processed, eta = Math.ceil((elapsed / 1000) * remaining / (processed - last)); let remaining = assets.length - processed, eta = Math.ceil((elapsed / 1000) * remaining / (processed - last));
setStatus(remaining + " assets remaining be verified/updated " + setStatus(remaining + " assets remaining be verified/updated " +
"(" + newEntries + " new entries, " + (processed - newEntries) + " up-to-date so far). ETA " + eta + "s"); "(" + newEntries + " new entries, " + needsProcessing.length + " need processing," + (processed - newEntries) + " up-to-date so far). ETA " + eta + "s");
last = processed; last = processed;
start = Date.now(); start = Date.now();
}); });