diff options
| author | BardofSprites <[email protected]> | 2024-12-16 08:05:40 -0500 |
|---|---|---|
| committer | BardofSprites <[email protected]> | 2024-12-16 08:05:40 -0500 |
| commit | 741019b9e8924bd6132e54121f0a8c4a84a0bd43 (patch) | |
| tree | 984d8978f57d4e047504386fee33aa00740b3295 /bin/.local | |
| parent | 1ae2b55c4321c43169ae840449ed4ed6c78da0e4 (diff) | |
unfinished weather script
Diffstat (limited to 'bin/.local')
| -rw-r--r-- | bin/.local/bin/scripts/lisp/weather.scm | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/bin/.local/bin/scripts/lisp/weather.scm b/bin/.local/bin/scripts/lisp/weather.scm new file mode 100644 index 0000000..91acee7 --- /dev/null +++ b/bin/.local/bin/scripts/lisp/weather.scm @@ -0,0 +1,30 @@ +(use rfc.http) +(use rfc.uri) +(use file.util) +(use gauche.process) + +(define radar-url "https://radar.weather.gov/ridge/standard/KLVX_loop.gif") +(define radar-gif-path "/tmp/latest_radar.gif") +(define lat 38.3051) +(define lon -85.5742) +(define api-url "https://api.weather.gov/points/38.3051,-85.5742") +(define forecast-url "https://api.weather.gov/gridpoints/LMK/56,80/forecast") + +(define (download-weather-radar-gif url filename) + (let-values (((status headers body) + (http-get (uri-ref url 'host) + (uri-ref url 'path) + :secure #t + :receiver (http-file-receiver filename)))) + (unless (string=? status "200") + (error "Failed to download file" url status)) + filename)) + +(define (play-radar-gif) + (let* ([mpv-command + (list "mpv" + "--loop=inf" + "--autofit=400x480" + radar-gif-path)] + [process (run-process mpv-command)]) + (process-wait process))) |
