Use raw flac (#408)

* Use raw

* clean not used

* Add soundfile

* Add soundfile

* Update scripts/update_birdnet_snippets.sh

Co-authored-by: Nachtzuster <Nachtzuster@users.noreply.github.com>

---------

Co-authored-by: Nachtzuster <Nachtzuster@users.noreply.github.com>
This commit is contained in:
Alexandre
2025-08-02 21:02:07 +02:00
committed by GitHub
parent df15948083
commit 176a105782
3 changed files with 4 additions and 4 deletions
+1
View File
@@ -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
+2 -4
View File
@@ -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: