Simple script to read the wildfire list from the Catalonia fireservice website.
  • Python 97.4%
  • Dockerfile 2.6%
Find a file
Christof Damian 57a84fe063
All checks were successful
Build and push container image / build (push) Successful in 46s
Add town hashtags to Mastodon posts with priority-based limit handling
Generate hashtags from town names mentioned in fire updates, prioritising
new fires over changed over removed. Town tags are trimmed to keep the
post within Mastodon's 500-character limit. Also removes #EmergencyUpdate
from the base tags.
2026-04-08 15:25:42 +02:00
.forgejo/workflows Use buildah with vfs/chroot for Codeberg runners 2026-04-03 22:43:53 +02:00
.env.example docker, some error logging, optional mastodon post 2025-08-18 16:18:36 +02:00
.gitignore docker, some error logging, optional mastodon post 2025-08-18 16:18:36 +02:00
Dockerfile docker, some error logging, optional mastodon post 2025-08-18 16:18:36 +02:00
README.md Add README 2026-04-03 22:59:37 +02:00
requirements-dev.txt Pin dependency versions and add dev dependencies for security auditing 2026-04-08 15:15:18 +02:00
requirements.txt Pin dependency versions and add dev dependencies for security auditing 2026-04-08 15:15:18 +02:00
test_wildfire_monitor.py Add town hashtags to Mastodon posts with priority-based limit handling 2026-04-08 15:25:42 +02:00
wildfire_data_retriever.py store state and compare 2025-08-18 10:38:28 +02:00
wildfire_monitor.py Add town hashtags to Mastodon posts with priority-based limit handling 2026-04-08 15:25:42 +02:00

Wildfires

Monitors active wildfire emergencies in Catalonia and posts updates to Mastodon when something changes.

Data source: Catalonia fire service via ArcGIS Feature Server.

How it works

On each run the script fetches the current list of active emergencies, compares it to the previous run (stored in wildfire_data.json), and posts a summary to Mastodon only when something has changed (new fires, status changes, or fires no longer active). The first run bootstraps the state silently without posting.

Configuration

Copy .env.example to .env and fill in:

MASTODON_INSTANCE_URL=https://your-instance.social/
MASTODON_ACCESS_TOKEN=your-token-here
DATA_FILE=wildfire_data.json   # optional, defaults to current directory

Running locally

pip install -r requirements.txt
python wildfire_monitor.py                  # fetch and display, no post
python wildfire_monitor.py --post-to-mastodon  # fetch, display, and post if changed

Container

docker build -t wildfires .
docker run --rm --env-file .env -v ./data:/data wildfires

Deployment

The container image is built automatically via Forgejo Actions on push to main and pushed to codeberg.org/cdamian/wildfires:latest.

On onyx (the Mastodon server) it runs every 2 hours via a systemd timer using Podman. State persists in /var/lib/wildfires/wildfire_data.json on the host.