Skip to content

Commit

Permalink
Maximum file check
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattk70 committed Oct 18, 2024
1 parent 89f1500 commit 5af2648
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion js/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function extractWaveMetadata(filePath) {
const format = buffer.toString('utf-8', 8, 12); // Should be "WAVE"

if (chunkId !== 'RIFF' || format !== 'WAVE') {
return reject(new Error('Invalid WAV file'));
return reject(new Error('Invalid WAV file: ', filePath));
}

let currentOffset = 12; // Start after the RIFF header
Expand Down
10 changes: 8 additions & 2 deletions js/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1015,9 +1015,15 @@ async function onOpenFiles(args) {
showElement(['spectrogramWrapper'], false);
resetResults({clearSummary: true, clearPagination: true, clearResults: true});
resetDiagnostics();
// Store the file list and Load First audio file
STATE.openFiles = sanitisedList;
STATE.openFiles.length > 1 && STATE.openFiles.length < 25_000 && worker.postMessage({action: 'check-all-files-saved', files: STATE.openFiles});
// CHeck not more than 25k files
if (STATE.openFiles.length >= 25_000){
generateToast({message: `Chirpity limits the maximum number of open files to 25,000. Only the first 25,000 of the ${STATE.openFiles.length} attempted will be opened`})
STATE.openFiles.splice(25000)
}
// Store the file list and Load First audio file

STATE.openFiles.length > 1 && worker.postMessage({action: 'check-all-files-saved', files: STATE.openFiles});

// Sort file by time created (the oldest first):
if (STATE.openFiles.length > 1) {
Expand Down

0 comments on commit 5af2648

Please sign in to comment.