From 244091bcca386c2a096b263e042a2fed6e79c2b3 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Mon, 9 Sep 2024 18:42:44 +0100 Subject: [PATCH] added file parameter when file not found message sent to UI --- js/worker.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/worker.js b/js/worker.js index 7d2c0f29..2bb5fac3 100644 --- a/js/worker.js +++ b/js/worker.js @@ -1228,7 +1228,7 @@ const getWavePredictBuffers = async ({ predictionsRequested[file] = 0; let readStream; if (! fs.existsSync(file)) { - UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`}) + UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`, file: file}) return new Error('getWavePredictBuffers: Error extracting audio segment: File not found.'); } // extract the header. With bext and iXML metadata, this can be up to 128k, hence 131072 @@ -1341,7 +1341,7 @@ const getPredictBuffers = async ({ let chunkStart = start * sampleRate; return new Promise((resolve, reject) => { if (! fs.existsSync(file)) { - UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`}) + UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`, file: file}) return reject(new Error('getPredictBuffers: Error extracting audio segment: File not found.')); } let concatenatedBuffer = Buffer.alloc(0); @@ -1804,7 +1804,7 @@ const bufferToAudio = async ({ return new Promise(function (resolve, reject) { const bufferStream = new PassThrough(); if (! fs.existsSync(file)) { - UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`}) + UI.postMessage({event: 'generate-alert', message: `The requested audio file cannot be found: ${file}`, file: file}) return reject(new Error('bufferToAudio: Error extracting audio segment: File not found.')); } let ffmpgCommand = ffmpeg(file)