Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Handle Empty Audio Files Gracefully (GH-20) #39

Merged
merged 2 commits into from
Nov 11, 2024

Conversation

mbsantiago
Copy link
Collaborator

This PR addresses issue #20, where the batdetect CLI encountered errors when processing empty audio files. This scenario is common with AudioMoth devices experiencing low battery, as they may generate empty recordings.

To prevent a single empty file from halting the entire detect command:

  • Improved error handling: Added EOFError to the list of expected exceptions when reading audio file metadata. This error occurs when attempting to determine the sample rate of an empty file.
  • Better user feedback: The detect command now gracefully handles empty files, adding them to the list of problematic files and reporting them to the user upon completion.
  • Added test case: Created a new test case that specifically runs the detect command on an empty file, ensuring it no longer causes a failure.

Acknowledgments:

Thanks to @EvansMike for reporting this issue and providing valuable feedback.

@mbsantiago mbsantiago linked an issue Nov 11, 2024 that may be closed by this pull request
@mbsantiago mbsantiago merged commit d5753b9 into main Nov 11, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Doesn't handle 0 length audio files gracfully
1 participant