diff options
| author | St33v <github@f3rr3t.com> | 2022-01-04 11:03:09 +1100 |
|---|---|---|
| committer | St33v <github@f3rr3t.com> | 2022-01-04 11:03:09 +1100 |
| commit | 5bd065c98ecf28278c8ecbd3170e94a9cdd7a10f (patch) | |
| tree | 47f9ba4a4452c270a1265084c0578a52e4cd45d0 | |
bare bones
| -rw-r--r-- | notes.txt | 25 | ||||
| -rwxr-xr-x | synopticChart.sh | 26 |
2 files changed, 51 insertions, 0 deletions
diff --git a/notes.txt b/notes.txt new file mode 100644 index 0000000..47a8324 --- /dev/null +++ b/notes.txt @@ -0,0 +1,25 @@ +Notes on FTP 'scraper' for synoptic charts +SJP 28 Nov 2021 +host : zero +(home theatre PC Raspberry pi 4) + +# Background +I had been musing about making videos of the BOM synoptic charts for some time. +(I may have started this work elsewhere but here I am, proctrasinating instead of doing housework) +It was prompted by a rude message I got yesterday while innocently opening the BOM radar. It accused me of scraping. +It also directed me to the FTP site: + + +pdf file is the one to get. It is a svg image, which can provide higher resolutio than the supplied png file. +I have a vague memory of alredy going down this track, but not on the ftp site. + + + used ImageMagick convert to make the pdf into a png. +But I got an error. Apparently PDF can be hacked so this line was in +/etc/Imagemagick7/policy.xml +Advice from internet was to comment it out like this: + +<!-- <policy domain="delegate" rights="none" pattern="gs" /> --> + +That worked + diff --git a/synopticChart.sh b/synopticChart.sh new file mode 100755 index 0000000..75d2ae2 --- /dev/null +++ b/synopticChart.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# SJP 28 Nov 2021 +# Get synoptic weather charts from BOM and make them into a movie +# See notes about BOM. they don't like scrapers but permit anon FTP +# for *personal use* +# This script will be called froma timer, once every 6 hours, which is +# how oftern new charts are published. +# +# The timer will take care of scheduing the call to the script +# todo: check what happens with daylight saving... + +# Construct current date and time +# -u for UTC, just get the date portion. +datePart=$(date -u +%Y%m%d) + +# Now construct the 'time' pertion of the filename. +# It is always 0000, 0600, 1200, or 1800 + +timePart=0000 +currentchart=${datePart}-${timePart} +latestChart=IDY00030.${datePart}${timePart}.pdf + + +curl -o ${latestChart} ftp://ftp.bom.gov.au/anon/gen/fwo/${latestChart} +convert -density 300 ${latestChart} ${currentchart}.png + |
