|
@@ -148,18 +148,18 @@ const processWithHandbrake = (input, output, preset) => {
|
|
|
processOutput(` -> processing "${inputName}" to "${outputName}" with "${preset}"`);
|
|
processOutput(` -> processing "${inputName}" to "${outputName}" with "${preset}"`);
|
|
|
})
|
|
})
|
|
|
.on('error', err => {
|
|
.on('error', err => {
|
|
|
- processOutput(` -> processing ${outputName} error: ${err.message || err}.\n`);
|
|
|
|
|
|
|
+ processOutput(` -> processing "${outputName}" error: ${err.message || err}.\n`);
|
|
|
reject(err);
|
|
reject(err);
|
|
|
})
|
|
})
|
|
|
.on('progress', progress => {
|
|
.on('progress', progress => {
|
|
|
- processOutput(` -> processing ${outputName} - ${progress.percentComplete}%, ETA: ${progress.eta}`);
|
|
|
|
|
|
|
+ processOutput(` -> processing "${outputName}" - ${progress.percentComplete}%, ETA: ${progress.eta}`);
|
|
|
})
|
|
})
|
|
|
.on('cancelled', () => {
|
|
.on('cancelled', () => {
|
|
|
- processOutput(` -> processing ${outputName} cancelled\n`);
|
|
|
|
|
- reject(new Error(`Processing ${outputName} cancelled`));
|
|
|
|
|
|
|
+ processOutput(` -> processing "${outputName}" cancelled\n`);
|
|
|
|
|
+ reject(new Error(`Processing "${outputName}" cancelled`));
|
|
|
})
|
|
})
|
|
|
.on('complete', () => {
|
|
.on('complete', () => {
|
|
|
- processOutput(` -> processing ${outputName} complete\n`);
|
|
|
|
|
|
|
+ processOutput(` -> processing "${outputName}" complete\n`);
|
|
|
resolve(true);
|
|
resolve(true);
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
@@ -192,7 +192,7 @@ const processFile = async file => {
|
|
|
return false; // break this loop
|
|
return false; // break this loop
|
|
|
} else if (!found) {
|
|
} else if (!found) {
|
|
|
// was it found? .. nope
|
|
// was it found? .. nope
|
|
|
- processOutput(` -> ${path.basename(file)} [processing]`);
|
|
|
|
|
|
|
+ processOutput(` -> "${path.basename(file)}" [processing]`);
|
|
|
setFile(db, {
|
|
setFile(db, {
|
|
|
input: file,
|
|
input: file,
|
|
|
output: '',
|
|
output: '',
|
|
@@ -200,7 +200,7 @@ const processFile = async file => {
|
|
|
date: new Date(),
|
|
date: new Date(),
|
|
|
}); // push onto the list an entry
|
|
}); // push onto the list an entry
|
|
|
} else {
|
|
} else {
|
|
|
- processOutput(` -> ${path.basename(file)} [re-processing]`);
|
|
|
|
|
|
|
+ processOutput(` -> "${path.basename(file)}" [re-processing]`);
|
|
|
setFile(db, file, {
|
|
setFile(db, file, {
|
|
|
status: '',
|
|
status: '',
|
|
|
date: new Date(),
|
|
date: new Date(),
|
|
@@ -240,7 +240,7 @@ const processFile = async file => {
|
|
|
if (fs.existsSync(output)) {
|
|
if (fs.existsSync(output)) {
|
|
|
let outputSize = await getFilesize(output); //get output filesize
|
|
let outputSize = await getFilesize(output); //get output filesize
|
|
|
if (outputSize > 100) { //make sure its bigger than 100k
|
|
if (outputSize > 100) { //make sure its bigger than 100k
|
|
|
- processOutput(` -> ${path.basename(file)} [skipping ... already processed]\n`);
|
|
|
|
|
|
|
+ processOutput(` -> "${path.basename(file)}" [skipping ... already processed]\n`);
|
|
|
setFile(db, file, {
|
|
setFile(db, file, {
|
|
|
output: output,
|
|
output: output,
|
|
|
status: 'success',
|
|
status: 'success',
|
|
@@ -256,7 +256,7 @@ const processFile = async file => {
|
|
|
});
|
|
});
|
|
|
// create parent if required
|
|
// create parent if required
|
|
|
if (target && !fs.existsSync(target)) {
|
|
if (target && !fs.existsSync(target)) {
|
|
|
- processOutput(` -> creating parent directory: ${target}\n`);
|
|
|
|
|
|
|
+ processOutput(` -> creating parent directory "${target}"\n`);
|
|
|
fs.mkdirSync(target, {
|
|
fs.mkdirSync(target, {
|
|
|
recursive: true,
|
|
recursive: true,
|
|
|
});
|
|
});
|
|
@@ -368,11 +368,11 @@ const main = async () => {
|
|
|
})
|
|
})
|
|
|
.on('change', file => {
|
|
.on('change', file => {
|
|
|
// when a file changes ...
|
|
// when a file changes ...
|
|
|
- console.log(` -> ${file} has been changed`);
|
|
|
|
|
|
|
+ console.log(` -> "${file}" has been changed`);
|
|
|
})
|
|
})
|
|
|
.on('unlink', async file => {
|
|
.on('unlink', async file => {
|
|
|
// when a file is removed ...
|
|
// when a file is removed ...
|
|
|
- console.log(` -> ${file} has been removed`);
|
|
|
|
|
|
|
+ console.log(` -> "${file}" has been removed`);
|
|
|
cleanup(file);
|
|
cleanup(file);
|
|
|
})
|
|
})
|
|
|
.on('error', error => {
|
|
.on('error', error => {
|
|
@@ -383,5 +383,5 @@ const main = async () => {
|
|
|
(async () => {
|
|
(async () => {
|
|
|
main();
|
|
main();
|
|
|
})().catch(err => {
|
|
})().catch(err => {
|
|
|
- console.log('Error:', err.message || err);
|
|
|
|
|
|
|
+ console.log(` -> Error: ${err.message || err});
|
|
|
});
|
|
});
|