Tag ambient audio chunks with current OpenWeather conditions
Adds weather-tag.sh, a small failure-safe helper that queries OpenWeather's free "Current weather" endpoint and prints one tag from a fixed vocabulary (thunderstorm, rain, rainshower, snow, snowstorm, fog, windy, cloudy, clear) or nothing on any failure. ambient-record.sh calls it just before each 30-minute chunk so the filename reflects conditions at the moment of capture, e.g. east-08-30-00-thunderstorm.m4a east-12-00-00-clear.m4a A foggy dawn no longer mislabels the sunny afternoon files. Off by default. Enable with WEATHER_ENABLED=true and an OPENWEATHER_API_KEY entry in .env; missing key / API error / disabled toggle all fall through to the un-tagged filename, never blocking the recorder.
This commit is contained in:
@@ -174,6 +174,38 @@ LATITUDE="${LATITUDE:-0.0000}"
|
||||
LONGITUDE="${LONGITUDE:-0.0000}"
|
||||
TIMEZONE="${TIMEZONE:-America/New_York}"
|
||||
|
||||
# ── Weather tagging (OpenWeather) ─────────────────────────────────────────────
|
||||
# When enabled, ambient-record.sh queries OpenWeather's "Current weather"
|
||||
# endpoint just before each 30-minute audio chunk and appends a one-word
|
||||
# weather tag to the filename, e.g.:
|
||||
# east-08-30-00-thunderstorm.m4a
|
||||
# east-09-00-00-rain.m4a
|
||||
# east-09-30-00-cloudy.m4a
|
||||
# That way each chunk is labelled with what was happening DURING that chunk —
|
||||
# a foggy dawn won't mislabel the sunny afternoon files.
|
||||
#
|
||||
# Tag vocabulary (fixed set — anything else → no tag):
|
||||
# thunderstorm rain rainshower snow snowstorm
|
||||
# fog windy cloudy clear
|
||||
#
|
||||
# Setup:
|
||||
# 1. Get a free API key: https://openweathermap.org/api
|
||||
# (the free "Current weather" tier — 60 calls/min — is plenty)
|
||||
# 2. Add to .env: OPENWEATHER_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxx
|
||||
# 3. Confirm LATITUDE / LONGITUDE are set in .env (already needed by sunrise.py)
|
||||
# 4. Flip WEATHER_ENABLED=true below
|
||||
#
|
||||
# The query uses the same LATITUDE / LONGITUDE configured above — one location
|
||||
# for the whole installation; per-camera coordinates are not supported.
|
||||
#
|
||||
# Failure-safe: if the toggle is off, the key is missing, the network is down,
|
||||
# or the API errors out, weather-tag.sh prints nothing and the recorder falls
|
||||
# back to the un-tagged filename. ambient-record.sh never blocks on this.
|
||||
#
|
||||
# Manual test: ./weather-tag.sh (prints e.g. "cloudy" or nothing)
|
||||
WEATHER_ENABLED=false
|
||||
OPENWEATHER_API_KEY="${OPENWEATHER_API_KEY:-}"
|
||||
|
||||
# ── Cameras ───────────────────────────────────────────────────────────────────
|
||||
# List every camera name here (space-separated inside the parentheses).
|
||||
# Each name becomes a subfolder under BASE_DIR (images) and BASE_DIR/movies.
|
||||
|
||||
Reference in New Issue
Block a user