Skip to content

Instantly share code, notes, and snippets.

@sharl
Created June 7, 2019 09:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sharl/6b087ac00c4d1c9fb020cd96071c27fe to your computer and use it in GitHub Desktop.
Save sharl/6b087ac00c4d1c9fb020cd96071c27fe to your computer and use it in GitHub Desktop.
みんな大好き東京アメッシュ
#!/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