Skip to content

A live bird collage card for your Home Assistant dashboard.

Use raw flac (#408)

Alexandre176a10578242
diff --git a/requirements.txt b/requirements.txt
index d8993564..ef6c133c 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -16,3 +16,4 @@ requests
matplotlib
pillow
pyarrow==20.0.0
+soundfile
diff --git a/scripts/update_birdnet_snippets.sh b/scripts/update_birdnet_snippets.sh
index 85312cb7..f7b7ade4 100755
--- a/scripts/update_birdnet_snippets.sh
+++ b/scripts/update_birdnet_snippets.sh
@@ -141,6 +141,7 @@ if [ "$PY_VERSION" == 39 ] && [ "$tf_version" != "2.11.0" ] || [ "$PY_VERSION" !
fi
ensure_python_package inotify inotify
+ensure_python_package soundfile soundfile
if ! which inotifywait &>/dev/null;then
ensure_apt_updated
diff --git a/scripts/utils/reporting.py b/scripts/utils/reporting.py
index 336010b8..c8c5f62c 100644
--- a/scripts/utils/reporting.py
+++ b/scripts/utils/reporting.py
@@ -1,5 +1,4 @@
import glob
-import gzip
import json
import logging
import os
@@ -179,15 +178,14 @@ def bird_weather(file: ParseFileName, detections: [Detection]):
except Exception as e:
log.error("Error during FLAC conversion: %s", e)
return
- gzip_flac_data = gzip.compress(flac_data)
# POST soundscape to server
soundscape_url = (f'https://app.birdweather.com/api/v1/stations/'
f'{conf["BIRDWEATHER_ID"]}/soundscapes?timestamp={file.iso8601}')
try:
- response = requests.post(url=soundscape_url, data=gzip_flac_data, timeout=30,
- headers={'Content-Type': 'application/octet-stream', 'Content-Encoding': 'gzip'})
+ response = requests.post(url=soundscape_url, data=flac_data, timeout=30,
+ headers={'Content-Type': 'audio/flac'})
log.info("Soundscape POST Response Status - %d", response.status_code)
sdata = response.json()
except BaseException as e: