Only do NEF until we get ORF working
Signed-off-by: James Ketrenos <james_git@ketrenos.com>
This commit is contained in:
parent
aa8cfec2cc
commit
dede4f245c
@ -13,6 +13,9 @@ const picturesPath = config.get("picturesPath");
|
||||
|
||||
const processQueue = [], triedClean = [];
|
||||
|
||||
//const rawExtension = /\.(nef|orf)$/i;
|
||||
const rawExtension = /\.nef$/i;
|
||||
|
||||
function removeNewerFile(path, fileA, fileB) {
|
||||
fs.stat(path + "/" + fileA, function(err, statsA) {
|
||||
if (err) {
|
||||
@ -97,7 +100,7 @@ function scanDir(parent, path) {
|
||||
files = files.filter(function(file) {
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
/* If this file has an original NEF/ORF on the system, don't add the JPG to the DB */
|
||||
if (/\.(nef|orf)$/i.exec(files[i]) && file == files[i].replace(/\.(nef|orf)$/i, ".jpg")) {
|
||||
if (rawExtension.exec(files[i]) && file == files[i].replace(rawExtension, ".jpg")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -138,7 +141,7 @@ function scanDir(parent, path) {
|
||||
|
||||
const replacements = {
|
||||
path: path.slice(picturesPath.length),
|
||||
filename: file.replace(/\.(nef|orf)$/i, ".jpg") /* We will be converting from NEF/ORF => JPG */
|
||||
filename: file.replace(rawExtension, ".jpg") /* We will be converting from NEF/ORF => JPG */
|
||||
};
|
||||
|
||||
replacements.path = replacements.path || "/";
|
||||
@ -224,7 +227,7 @@ function convertRawToJpg(path, file) {
|
||||
path = picturesPath + path;
|
||||
|
||||
return new Promise(function(resolve, reject) {
|
||||
fs.stat(path + "/" + file.replace(/\.(nef|orf)$/i, ".jpg"), function(err, stats) {
|
||||
fs.stat(path + "/" + file.replace(rawExtension, ".jpg"), function(err, stats) {
|
||||
if (!err) {
|
||||
console.log("Skipping already converted file: " + file);
|
||||
return resolve();
|
||||
@ -238,7 +241,7 @@ function convertRawToJpg(path, file) {
|
||||
"--compression=90",
|
||||
"--exif",
|
||||
"--overwrite",
|
||||
"--output", path + "/" + file.replace(/\.(nef|orf)$/i, ".jpg"),
|
||||
"--output", path + "/" + file.replace(rawExtension, ".jpg"),
|
||||
path + "/" + file
|
||||
]);
|
||||
|
||||
@ -309,16 +312,16 @@ function triggerWatcher() {
|
||||
|
||||
let tmp = Promise.resolve(file);
|
||||
/* If this is a Nikon RAW file, convert it to JPG and move to /raw dir */
|
||||
if (/\.(nef|orf)$/i.exec(file)) {
|
||||
tmp = existsPromise(picturesPath + path + "/" + file.replace(/\.(nef|orf)$/i, ".jpg")).then(function(exists) {
|
||||
if (rawExtension.exec(file)) {
|
||||
tmp = existsPromise(picturesPath + path + "/" + file.replace(rawExtension, ".jpg")).then(function(exists) {
|
||||
if (exists) {
|
||||
return file.replace(/\.(nef|orf)$/i, ".jpg"); /* We converted from NEF/ORF => JPG */
|
||||
return file.replace(rawExtension, ".jpg"); /* We converted from NEF/ORF => JPG */
|
||||
}
|
||||
|
||||
return mkdirPromise(picturesPath + path + "/raw").then(function() {
|
||||
return convertRawToJpg(path, file);
|
||||
}).then(function() {
|
||||
return file.replace(/\.(nef|orf)$/i, ".jpg"); /* We converted from NEF/ORF => JPG */
|
||||
return file.replace(rawExtension, ".jpg"); /* We converted from NEF/ORF => JPG */
|
||||
});
|
||||
});
|
||||
}
|
||||
@ -419,7 +422,7 @@ function triggerWatcher() {
|
||||
return moveCorrupt(path, file).then(function() {
|
||||
|
||||
/* If the original file was not a NEF/ORF, we are done... */
|
||||
if (!/\.(nef|orf)$/i.exec(entry[1])) {
|
||||
if (!rawExtension.exec(entry[1])) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user