From e1f3e8982d213cc30bac85b9837bf8f0b7ead462 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Thu, 7 Nov 2024 10:43:16 +0000 Subject: [PATCH 1/3] improved error message for missing file --- js/worker.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/js/worker.js b/js/worker.js index 765b8aa..9551ec8 100644 --- a/js/worker.js +++ b/js/worker.js @@ -109,7 +109,6 @@ Date.prototype.getWeekNumber = function(){ const ffmpegPath = require('@ffmpeg-installer/ffmpeg').path.replace('app.asar', 'app.asar.unpacked'); -//ffmpeg.setFfmpegPath(staticFfmpeg.path.replace('app.asar', 'app.asar.unpacked')); ffmpeg.setFfmpegPath(ffmpegPath); let predictionsRequested = {}, predictionsReceived = {}, filesBeingProcessed = []; let diskDB, memoryDB; @@ -1327,7 +1326,7 @@ const getPredictBuffers = async ({ }) => { if (! fs.existsSync(file)) { const found = await getWorkingFile(file); - if (!found) return + if (!found) throw new Error('Unable to locate ' + file); } // Ensure max and min are within range start = Math.max(0, start); @@ -1407,6 +1406,7 @@ async function processAudio (file, start, end, chunkStart, highWaterMark, sample STREAM.on('end', () => { // Handle any remaining data in the buffer if (currentIndex > 0) { // Check if there's any data left in the buffer + AUDIO_BACKLOG++; prepareWavForModel(audioBuffer.subarray(0, currentIndex), file, end, chunkStart); feedChunksToModel(...predictQueue.shift()); } @@ -1470,8 +1470,9 @@ const fetchAudioBuffer = async ({ file = '', start = 0, end = undefined }) => { if (! fs.existsSync(file)) { - file = await getWorkingFile(file); - if (!file) throw new Error('Cannot locate ' + file); + const result = await getWorkingFile(file); + if (!result) throw new Error('Cannot locate ' + file); + else file = result; } METADATA[file]?.duration || await setMetadata({file:file}); end ??= METADATA[file].duration; @@ -2227,8 +2228,8 @@ async function processNextFile({ if (FILE_QUEUE.length) { let file = FILE_QUEUE.shift() const found = await getWorkingFile(file).catch(error => { - console.warn('Error in getWorkingFile', error); - generateAlert({type: 'warning', message: error.message}) + console.warn('Can\'t locate: ', file); + generateAlert({type: 'warning', message: 'Cannot locate: ' + file}) }); if (found) { if (end) {} From 214b7b5da27c183d15cdbb8e21251d87de094d48 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Thu, 7 Nov 2024 10:44:52 +0000 Subject: [PATCH 2/3] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0f6a382..57d7cc4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chirpity", - "version": "2.2.6", + "version": "2.3.0", "description": "Chirpity Nocmig", "main": "main.js", "scripts": { From 7b0b7bc89412b99cf9a8c0600da3b6bc3e3b3501 Mon Sep 17 00:00:00 2001 From: Mattk70 Date: Thu, 7 Nov 2024 10:50:34 +0000 Subject: [PATCH 3/3] tidied up package.json --- package.json | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 57d7cc4..82f4799 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,10 @@ "start": "electron .", "prebuild": "node prebuild.js", "preexport": "node prebuild.js", + "preAppImage": "node prebuild.js", "minify": "node minify.js", - "export": "electron-builder build --linux --x64 --m", + "export": "electron-builder build --m", + "AppImage": "electron-builder build --linux --x64", "build": "electron-builder --win --x64 -p always", "postinstall": "electron-builder install-app-deps" },