Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Nov 7, 2024
2 parents 15fc488 + 7b0b7bc commit c5a8c5b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
13 changes: 7 additions & 6 deletions js/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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) {}
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"name": "chirpity",
"version": "2.2.6",
"version": "2.3.0",
"description": "Chirpity Nocmig",
"main": "main.js",
"scripts": {
"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"
},
Expand Down

0 comments on commit c5a8c5b

Please sign in to comment.