Created
June 7, 2019 09:37
-
-
Save sharl/6b087ac00c4d1c9fb020cd96071c27fe to your computer and use it in GitHub Desktop.
みんな大好き東京アメッシュ
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# -*- coding: utf-8 -*- | |
# 東京アメッシュの画像を取得して合成 | |
now=$(date +%s) | |
BASE_URL=https://tokyo-ame.jwa.or.jp | |
MAP=/map/map000.jpg | |
MSK=/map/msk000.png | |
# https://tokyo-ame.jwa.or.jp/mesh/000/201906071525.gif | |
rfm=$(date --date=@$((now / (5 * 60) * 5 * 60 - 5 * 60)) +%Y%m%d%H%M) | |
RFM=/mesh/000/${rfm}.gif | |
mapfile=$(/bin/mktemp).jpg | |
mskfile=$(/bin/mktemp).png | |
rfmfile=$(/bin/mktemp).gif | |
layer00=$(/bin/mktemp).png | |
layer01=$(/bin/mktemp).png | |
trap "/bin/rm -f $mapfile $mskfile $rfmfile $layer00 $layer01" 0 1 2 3 15 | |
curl -s ${BASE_URL}${MAP} > ${mapfile} | |
curl -s ${BASE_URL}${MSK} > ${mskfile} | |
curl -s ${BASE_URL}${RFM} > ${rfmfile} | |
composite -compose over ${rfmfile} ${mapfile} ${layer00} | |
composite -compose over ${mskfile} ${layer00} ${layer01} | |
img2sixel ${layer01} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment