Utility classes
Utility classes
DirectoryAnalyzer
DirectoryAnalyzer
can process a directory and analyze contained files.
def on_analyze_complete(recording):
print(recording.path)
pprint(recording.detections)
directory = DirectoryAnalyzer(
"/Birds/mp3_dir",
patterns=["*.mp3", "*.wav"]
)
directory.on_analyze_complete = on_analyze_complete
directory.process()
See the full example for analyzer options and error handling callbacks.
DirectoryMultiProcessingAnalyzer
DirectoryMultiProcessingAnalyzer
can process a directory and analyze contained files, using multiple processes asynchronously.
def on_analyze_directory_complete(recordings):
for recording in recordings:
pprint(recording.detections)
directory = "."
batch = DirectoryMultiProcessingAnalyzer(
"/Birds/mp3_dir",
patterns=["*.mp3", "*.wav"]
)
batch.on_analyze_directory_complete = on_analyze_directory_complete
batch.process()
See the full example for analyzer options and error handling callbacks.
DirectoryWatcher
DirectoryWatcher
can watch a directory and analyze new files as they are created.
def on_analyze_complete(recording):
print(recording.path)
pprint(recording.detections)
watcher = DirectoryWatcher("/Birds/mp3_dir")
watcher.on_analyze_complete = on_analyze_complete
watcher.watch()
See the full example for analyzer options and error handling callbacks.
SpeciesList
SpeciesList
uses BirdNET-Analyzer to predict species lists from location and date.