Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,976 changes: 867 additions & 1,109 deletions .development/wildweb-e_mock_data.json

Large diffs are not rendered by default.

6 changes: 0 additions & 6 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ jobs:
TELEGRAM_BOT_ID: ${{ secrets.TELEGRAM_BOT_ID }}
TELEGRAM_BOT_SECRET: ${{ secrets.TELEGRAM_BOT_SECRET }}
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
TWILIO_SID: ${{ secrets.TWILIO_SID }}
TWILIO_AUTH_TOKEN: ${{ secrets.TWILIO_AUTH_TOKEN }}
TWILIO_NUMBER: ${{ secrets.TWILIO_NUMBER }}
URL_SHORT: ${{ secrets.URL_SHORT }}
run: |
cat <<EOT > .env
Expand All @@ -52,9 +49,6 @@ jobs:
TELEGRAM_BOT_ID=${TELEGRAM_BOT_ID}
TELEGRAM_BOT_SECRET=${TELEGRAM_BOT_SECRET}
TELEGRAM_CHAT_ID=${TELEGRAM_CHAT_ID}
TWILIO_SID=${TWILIO_SID}
TWILIO_AUTH_TOKEN=${TWILIO_AUTH_TOKEN}
TWILIO_NUMBER=${TWILIO_NUMBER}
URL_SHORT=${URL_SHORT}
EOT
- name: Setup Faux Contacts DB
Expand Down
1 change: 0 additions & 1 deletion extras/alertca_processed.json

This file was deleted.

29 changes: 0 additions & 29 deletions extras/webcam_ingestion.py

This file was deleted.

48 changes: 8 additions & 40 deletions firebot.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import sys
import json
import re
import geopy.distance
import json_log_formatter
import requests
import tinydb
Expand Down Expand Up @@ -405,7 +404,7 @@ def generate_plain_initial_notif_body(inci_dict):
nearby_cameras = nearby_cameras_url(inci_dict)

if nearby_cameras:
notif_body += '\n- Cams within 8 mi.: ' + shorten_url(nearby_cameras['url'])
notif_body += '\n- Nearby Cams: ' + shorten_url(nearby_cameras)

return notif_body

Expand Down Expand Up @@ -443,7 +442,7 @@ def generate_plain_diff_body(inci_dict, event_changes):
nearby_cameras = nearby_cameras_url(inci_dict)

if nearby_cameras:
notif_body += '\n- Cams within 8 mi.: ' + shorten_url(nearby_cameras['url'])
notif_body += '\n- Nearby Cams: ' + shorten_url(nearby_cameras)

return notif_body

Expand Down Expand Up @@ -483,8 +482,7 @@ def generate_rich_diff_body(inci_dict, inci_db_entry, event_changes):
nearby_cameras = nearby_cameras_url(inci_dict)

if nearby_cameras:
notif_body += '\n• <a href="' + nearby_cameras['url'] + '">ALERT Wildfire Webcams' + \
' within 8 mi. (' + nearby_cameras['count'] + ' cams)</a>'
notif_body += '\n• <a href="' + nearby_cameras + '">ALERTCalifornia Webcams</a>'

if 'BROADCASTIFY_ID' in secrets:
notif_body += '\n• <a href="https://www.broadcastify.com/listen/feed/' + \
Expand Down Expand Up @@ -533,8 +531,7 @@ def generate_notif_body(inci_dict):
nearby_cameras = nearby_cameras_url(inci_dict)

if nearby_cameras:
notif_body += '\n• <a href="' + nearby_cameras['url'] + '">ALERT Wildfire Webcams' +\
' within 8 mi. (' + nearby_cameras['count'] + ' cams)</a>'
notif_body += '\n• <a href="' + nearby_cameras + '">ALERTCalifornia Webcams</a>'

notif_body += '\n• Lat/Long (DDM): ' + empty_fill(str(inci_dict['y']) + ', ' + \
str(inci_dict['x'])) + '\n• Lat/Long (DD): ' + \
Expand Down Expand Up @@ -805,40 +802,11 @@ def process_daily_recap():

def nearby_cameras_url(inci_dict):
"""
When given a dict with lat/long ('x','y') determines if there are any
wildfire cameras within 8 miles, and returns a URL showing any matches
When given a dict with lat/long ('x','y') structures an alertcalifornia URL
"""
if os.path.exists('./extras/alertca_processed.json') is False:
logger.error('No webcam manifest exists, skipping identify_nearby_cameras()')
return False

camera_url = 'https://alertca.live/tileset?camIds='
match_count = 0

with open('./extras/alertca_processed.json', encoding='utf8') as camera_json:
for camera in json.load(camera_json)['cameras']:
this_coords = (camera['lat'],camera['lon'])
this_distance = geopy.distance.geodesic(
(convert_gps_to_decimal(inci_dict['y']),convert_gps_to_decimal(inci_dict['x'])),
this_coords
).mi

if this_distance <= 8:
match_count += 1
camera['distance'] = this_distance

if match_count == 1:
prefix = ''
else:
prefix = ','

camera_url += prefix + str(camera['id'])

if match_count > 0:
return {
"url": camera_url,
"count": str(match_count)
}
if 'x' in inci_dict and 'y' in inci_dict:
return 'https://cameras.alertcalifornia.org/?pos=' + str(inci_dict['y']) + '_' + \
str(inci_dict['x']) + '_11'

return False

Expand Down
47 changes: 20 additions & 27 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,20 @@
astroid==2.11.3
certifi==2023.7.22
chardet==4.0.0
dill==0.3.4
geographiclib==1.52
geopy==2.2.0
idna==2.10
install==1.3.5
iso6709==0.1.5
isort==5.10.1
JSON-log-formatter==0.5.1
lazy-object-proxy==1.7.1
lxml==4.6.3
mccabe==0.7.0
platformdirs==2.5.2
PyJWT==1.7.1
pylint==2.13.7
python-dotenv==0.20.0
pytz==2021.1
requests==2.25.1
six==1.16.0
tinydb==4.5.0
tomli==2.0.1
twilio==6.61.0
typing_extensions==4.2.0
urllib3==1.26.18
wrapt==1.14.0
aiohappyeyeballs==2.4.4
aiohttp==3.11.11
aiohttp-retry==2.9.1
aiosignal==1.3.2
attrs==25.1.0
certifi==2025.1.31
charset-normalizer==3.4.1
frozenlist==1.5.0
idna==3.10
JSON-log-formatter==1.1
lxml==5.3.0
multidict==6.1.0
propcache==0.2.1
PyJWT==2.10.1
python-dotenv==1.0.1
requests==2.32.3
tinydb==4.8.2
twilio==9.4.4
urllib3==2.3.0
yarl==1.18.3
Loading