-
Notifications
You must be signed in to change notification settings - Fork 0
/
hungary.sh
executable file
·55 lines (49 loc) · 15.6 KB
/
hungary.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
# Temperature map in Hungary.
# Weather informations provided by http://koponyeg.hu
# Map printing based on TCL script by lew046 (HUP).
# http://hup.hu/node/136351 ( lew046 | 2014. október 30., csütörtök - 22:39 )
match() {
regexp='"name":"'$2'","longitude":\-?[0-9\.]+,"latitude":\-?[0-9\.]+,"value":(\-?[0-9\.]+),';
[[ $1 =~ $regexp ]];
echo "${BASH_REMATCH[1]}°C";
}
rawdata=$(curl -s "https://koponyeg.hu/elorejelzes/Budapest?m=weathermap&a=temperaturemap&_ajax=1");
# Expected result:
# {"temperature":{"measurements":[{"name":"Gy\u0151r","longitude":17.726473,"latitude":47.708584,"value":9.4,"sky_icon":"borult nappal"},{"name":"Eger","longitude":20.38,"latitude":47.9,"value":10.9,"sky_icon":"valtozoan_felhos nappal"},{"name":"Budapest (Pest)","longitude":19.107578,"latitude":47.543687,"value":8.2,"sky_icon":"borult nappal"},{"name":"Kaposv\u00e1r","longitude":17.763545,"latitude":46.352964,"value":14.1,"sky_icon":"borult nappal"},{"name":"P\u00e1ka","longitude":16.631935,"latitude":46.585898,"value":9.5,"sky_icon":"borult nappal"},{"name":"Sz\u00e9kesfeh\u00e9rv\u00e1r (S\u00e1rkeresztes)","longitude":18.347315,"latitude":47.253983,"value":9.1,"sky_icon":"borult nappal"},{"name":"B\u00e9k\u00e9scsaba","longitude":21.097407,"latitude":46.677706,"value":12.5,"sky_icon":"valtozoan_felhos nappal"},{"name":"Szeksz\u00e1rd","longitude":18.703629,"latitude":46.348356,"value":16.2,"sky_icon":"borult nappal"},{"name":"Szombathely","longitude":16.639358,"latitude":47.206056,"value":9.7,"sky_icon":"valtozoan_felhos nappal"},{"name":"Salg\u00f3tarj\u00e1n","longitude":19.768999,"latitude":48.055927,"value":10.3,"sky_icon":"borult nappal"},{"name":"Budapest (Buda)","longitude":19.011667,"latitude":47.424354,"value":10.3,"sky_icon":"borult nappal"},{"name":"Szolnok (J\u00e1szboldogh\u00e1za)","longitude":19.99659,"latitude":47.36462,"value":8.7,"sky_icon":"borult nappal"},{"name":"Szeged (Sz\u0151reg)","longitude":20.194488,"latitude":46.203996,"value":13.1,"sky_icon":"valtozoan_felhos nappal"},{"name":"Miskolc","longitude":20.787305,"latitude":48.068802,"value":10.5,"sky_icon":"borult nappal"},{"name":"Kecskem\u00e9t (Ball\u00f3sz\u00f6g)","longitude":19.589257,"latitude":46.868658,"value":12.1,"sky_icon":"borult nappal"},{"name":"Debrecen","longitude":21.39378,"latitude":47.448406,"value":12.8,"sky_icon":"valtozoan_felhos nappal"},{"name":"Zalaegeszeg (Tesk\u00e1nd)","longitude":16.8439,"latitude":46.84,"value":9.7,"sky_icon":"borult nappal"},{"name":"P\u00e9cs","longitude":18.220186,"latitude":46.057803,"value":13.6,"sky_icon":"valtozoan_felhos nappal"},{"name":"Ny\u00edregyh\u00e1za","longitude":21.72,"latitude":47.96,"value":12.4,"sky_icon":"valtozoan_felhos nappal"},{"name":"Sopron","longitude":16.59,"latitude":47.68,"value":9.2,"sky_icon":"valtozoan_felhos nappal"},{"name":"Ab\u00e1dszal\u00f3k (Tisza-t\u00f3)","longitude":20.59889,"latitude":47.475,"value":10.4,"sky_icon":"borult nappal"},{"name":"Si\u00f3fok (Balaton)","longitude":18.031628,"latitude":46.899356,"value":10.5,"sky_icon":"borult nappal"},{"name":"Magl\u00f3d","longitude":19.362225,"latitude":47.442577,"value":9.7,"sky_icon":"borult nappal"},{"name":"H\u00e1rsk\u00fat","longitude":17.8109,"latitude":47.1865,"value":10.1,"sky_icon":"borult nappal"},{"name":"Veszpr\u00e9m","longitude":17.9093,"latitude":47.1028,"value":9.8,"sky_icon":"borult nappal"},{"name":"Iregszemcse","longitude":18.191447,"latitude":46.692368,"value":11.6,"sky_icon":"valtozoan_felhos nappal"},{"name":"Gy\u0151rszemere","longitude":17.580269,"latitude":47.590425,"value":9.1,"sky_icon":"borult nappal"},{"name":"Kir\u00e1lyszentistv\u00e1n","longitude":18.0464,"latitude":47.1086,"value":9.6,"sky_icon":"borult nappal"},{"name":"H\u00e9th\u00e1zpuszta","longitude":18.1956,"latitude":47.2787,"value":8.7,"sky_icon":"borult nappal"},{"name":"Szabadka","longitude":19.67,"latitude":46.09833,"value":14,"sky_icon":"valtozoan_felhos nappal"},{"name":"S\u00e1rmell\u00e9k","longitude":17.167647,"latitude":46.716625,"value":9.2,"sky_icon":"valtozoan_felhos nappal"},{"name":"Gyenesdi\u00e1s","longitude":17.285027,"latitude":46.773335,"value":9.7,"sky_icon":"valtozoan_felhos nappal"},{"name":"S\u00fcmeg","longitude":17.283745,"latitude":46.978779,"value":8.7,"sky_icon":"valtozoan_felhos nappal"}],"settings":{"startLatitude":45.3,"endLatitude":49,"startLongitude":15,"endLongitude":24,"colorPalette":{"-5":"#ac4fb0","-4":"#9d25b0","-3":"#841ab0","-2":"#6639b7","-1":"#5f1eb7","0":"#4e118f","1":"#4b3fa6","2":"#3e53a0","3":"#7d7be5","4":"#6c6ad8","5":"#3372bb","6":"#5678FB","7":"#6c9afb","8":"#0466e1","9":"#6c9afb","10":"#0bccff","11":"#4eeff4","12":"#03bcd3","13":"#0394ae","14":"#266864","15":"#007762","16":"#009588","17":"#269c24","18":"#40cd16","19":"#90de40","20":"#8ac049","21":"#c1e138","22":"#e7f00c","23":"#fdff00","24":"#fddd08","25":"#fdc208","26":"#ff9e05","27":"#fd7c24","28":"#ff8905","29":"#fd5524","30":"#fd3324"}},"image":"https:\/\/img.koponyeg.hu\/weathermaps\/homerseklet\/homerseklet_20201024_092034.png","created":"2020-10-24 09:20:44"},"wind":{"measurements":[{"name":"Gy\u0151r","longitude":17.726473,"latitude":47.708584,"value":1,"wind_direction":"DNY"},{"name":"Eger","longitude":20.38,"latitude":47.9,"value":2,"wind_direction":"D"},{"name":"Budapest (Pest)","longitude":19.107578,"latitude":47.543687,"value":1,"wind_direction":"\u00c9K"},{"name":"Kaposv\u00e1r","longitude":17.763545,"latitude":46.352964,"value":5,"wind_direction":"DNY"},{"name":"P\u00e1ka","longitude":16.631935,"latitude":46.585898,"value":16,"wind_direction":"\u00c9"},{"name":"Sz\u00e9kesfeh\u00e9rv\u00e1r (S\u00e1rkeresztes)","longitude":18.347315,"latitude":47.253983,"value":4,"wind_direction":"DNY"},{"name":"B\u00e9k\u00e9scsaba","longitude":21.097407,"latitude":46.677706,"value":1,"wind_direction":"D"},{"name":"Szeksz\u00e1rd","longitude":18.703629,"latitude":46.348356,"value":2,"wind_direction":"D"},{"name":"Szombathely","longitude":16.639358,"latitude":47.206056,"value":6,"wind_direction":"\u00c9NY"},{"name":"Salg\u00f3tarj\u00e1n","longitude":19.768999,"latitude":48.055927,"value":7,"wind_direction":"D"},{"name":"Budapest (Buda)","longitude":19.011667,"latitude":47.424354,"value":1,"wind_direction":"NY"},{"name":"Szolnok (J\u00e1szboldogh\u00e1za)","longitude":19.99659,"latitude":47.36462,"value":7,"wind_direction":"\u00c9"},{"name":"Miskolc","longitude":20.787305,"latitude":48.068802,"value":0,"wind_direction":"\u00c9"},{"name":"Karcag","longitude":20.928829,"latitude":47.313386,"value":14,"wind_direction":"DNY"},{"name":"Kecskem\u00e9t (Ball\u00f3sz\u00f6g)","longitude":19.589257,"latitude":46.868658,"value":1,"wind_direction":"D"},{"name":"Debrecen","longitude":21.39378,"latitude":47.448406,"value":15,"wind_direction":"DNY"},{"name":"Zalaegeszeg (Tesk\u00e1nd)","longitude":16.8439,"latitude":46.84,"value":2,"wind_direction":"NY"},{"name":"Ny\u00edregyh\u00e1za","longitude":21.72,"latitude":47.96,"value":1,"wind_direction":"DNY"},{"name":"Sopron","longitude":16.59,"latitude":47.68,"value":2,"wind_direction":"DK"},{"name":"Ab\u00e1dszal\u00f3k (Tisza-t\u00f3)","longitude":20.59889,"latitude":47.475,"value":2,"wind_direction":"DNY"},{"name":"Si\u00f3fok (Balaton)","longitude":18.031628,"latitude":46.899356,"value":13,"wind_direction":"DNY"},{"name":"Magl\u00f3d","longitude":19.362225,"latitude":47.442577,"value":1,"wind_direction":"D"},{"name":"H\u00e1rsk\u00fat","longitude":17.8109,"latitude":47.1865,"value":1,"wind_direction":"\u00c9K"},{"name":"Veszpr\u00e9m","longitude":17.9093,"latitude":47.1028,"value":2,"wind_direction":"NY"},{"name":"Gy\u0151rszemere","longitude":17.580269,"latitude":47.590425,"value":1,"wind_direction":"DNY"},{"name":"Kir\u00e1lyszentistv\u00e1n","longitude":18.0464,"latitude":47.1086,"value":3,"wind_direction":"\u00c9K"},{"name":"H\u00e9th\u00e1zpuszta","longitude":18.1956,"latitude":47.2787,"value":6,"wind_direction":"\u00c9NY"},{"name":"S\u00e1rmell\u00e9k","longitude":17.167647,"latitude":46.716625,"value":0,"wind_direction":"\u00c9"},{"name":"Gyenesdi\u00e1s","longitude":17.285027,"latitude":46.773335,"value":1,"wind_direction":"DNY"},{"name":"S\u00fcmeg","longitude":17.283745,"latitude":46.978779,"value":3,"wind_direction":"\u00c9NY"}],"settings":{"startLatitude":45.3,"endLatitude":49,"startLongitude":15,"endLongitude":24,"colorPalette":{"0":"#ceffd7","1":"#81f997","5":"#00e195","6":"#00c698","10":"#74e872","11":"#00cb6c","15":"#00b572","16":"#00d075","20":"#00af58","21":"#009f57","25":"#00b04c","26":"#00964a","30":"#008649","31":"#009240","35":"#007b3f","36":"#006d50","40":"#005c37","41":"#006e38","45":"#00853a","46":"#ffdc2f","50":"#feeb32","51":"#fffcb3","55":"#f9d22d","56":"#f9c22a","60":"#f9ad27","61":"#ffaf28","65":"#ff9c43","66":"#ff8422","70":"#f78f22","71":"#f77920","75":"#fb5e1d","76":"#ff2a1a","80":"#ec2617","81":"#d32114","85":"#dc2315","86":"#bf1d10","90":"#ac190e","91":"#ef619c","95":"#ef369c","96":"#d4329c","100":"#b861d2","101":"#b83bd2","105":"#9e39d2","106":"#a0479a","110":"#952a9a","111":"#83289a","115":"#823775","116":"#771e75","120":"#541b75"}},"image":"https:\/\/img.koponyeg.hu\/weathermaps\/szelsebesseg\/szelsebesseg_20201024_092105.png","created":"2020-10-24 09:21:15"},"rain":{"measurements":[{"name":"Gy\u0151r","longitude":17.726473,"latitude":47.708584,"value":0},{"name":"Eger","longitude":20.38,"latitude":47.9,"value":0},{"name":"Budapest (Pest)","longitude":19.107578,"latitude":47.543687,"value":0},{"name":"Kaposv\u00e1r","longitude":17.763545,"latitude":46.352964,"value":0},{"name":"P\u00e1ka","longitude":16.631935,"latitude":46.585898,"value":0},{"name":"Sz\u00e9kesfeh\u00e9rv\u00e1r (S\u00e1rkeresztes)","longitude":18.347315,"latitude":47.253983,"value":0},{"name":"B\u00e9k\u00e9scsaba","longitude":21.097407,"latitude":46.677706,"value":0.1},{"name":"Szeksz\u00e1rd","longitude":18.703629,"latitude":46.348356,"value":0},{"name":"Szombathely","longitude":16.639358,"latitude":47.206056,"value":0.1},{"name":"Salg\u00f3tarj\u00e1n","longitude":19.768999,"latitude":48.055927,"value":0},{"name":"Budapest (Buda)","longitude":19.011667,"latitude":47.424354,"value":0},{"name":"Szolnok (J\u00e1szboldogh\u00e1za)","longitude":19.99659,"latitude":47.36462,"value":0},{"name":"Szeged (Sz\u0151reg)","longitude":20.194488,"latitude":46.203996,"value":0},{"name":"Miskolc","longitude":20.787305,"latitude":48.068802,"value":0},{"name":"Karcag","longitude":20.928829,"latitude":47.313386,"value":0},{"name":"Kecskem\u00e9t (Ball\u00f3sz\u00f6g)","longitude":19.589257,"latitude":46.868658,"value":0},{"name":"Debrecen","longitude":21.39378,"latitude":47.448406,"value":0},{"name":"Zalaegeszeg (Tesk\u00e1nd)","longitude":16.8439,"latitude":46.84,"value":0},{"name":"Ny\u00edregyh\u00e1za","longitude":21.72,"latitude":47.96,"value":0},{"name":"Sopron","longitude":16.59,"latitude":47.68,"value":0.2},{"name":"Ab\u00e1dszal\u00f3k (Tisza-t\u00f3)","longitude":20.59889,"latitude":47.475,"value":0},{"name":"Magl\u00f3d","longitude":19.362225,"latitude":47.442577,"value":0},{"name":"H\u00e1rsk\u00fat","longitude":17.8109,"latitude":47.1865,"value":0},{"name":"Veszpr\u00e9m","longitude":17.9093,"latitude":47.1028,"value":0},{"name":"Gy\u0151rszemere","longitude":17.580269,"latitude":47.590425,"value":0.1},{"name":"Kir\u00e1lyszentistv\u00e1n","longitude":18.0464,"latitude":47.1086,"value":0},{"name":"H\u00e9th\u00e1zpuszta","longitude":18.1956,"latitude":47.2787,"value":0.1},{"name":"Szabadka","longitude":19.67,"latitude":46.09833,"value":0},{"name":"S\u00e1rmell\u00e9k","longitude":17.167647,"latitude":46.716625,"value":0},{"name":"Gyenesdi\u00e1s","longitude":17.285027,"latitude":46.773335,"value":0},{"name":"S\u00fcmeg","longitude":17.283745,"latitude":46.978779,"value":0.1}],"settings":{"startLatitude":45.3,"endLatitude":49,"startLongitude":15,"endLongitude":24,"colorPalette":{"0":"#ceffd7","1":"#81f997","2":"#00e195","3":"#00c698","4":"#74e872","5":"#00cb6c","6":"#00b572","7":"#00d075","8":"#00af58","9":"#009f57","10":"#00b04c","11":"#00964a","12":"#008649","13":"#009240","14":"#007b3f","15":"#006d50","16":"#005c37","17":"#006e38","18":"#00853a","19":"#ffdc2f","20":"#feeb32","21":"#fffcb3","22":"#f9d22d","23":"#f9c22a","24":"#f9ad27","25":"#ffaf28","26":"#ff9c43","27":"#ff8422","28":"#f78f22","29":"#f77920","30":"#fb5e1d","31":"#ff2a1a","32":"#ec2617","33":"#d32114","34":"#dc2315","35":"#bf1d10","36":"#ac190e","37":"#ef619c","38":"#ef369c","39":"#d4329c","40":"#b861d2","41":"#b83bd2","42":"#9e39d2","43":"#a0479a","44":"#952a9a","45":"#83289a","46":"#823775","47":"#771e75","48":"#541b75","49":"#506bae","50":"#4488c5"}},"image":"https:\/\/img.koponyeg.hu\/weathermaps\/csapadek\/csapadek_20201024_092050.png","created":"2020-10-24 09:21:00"}
bh=$(match "$rawdata" 'Budapest \(Buda\)');
gh=$(match "$rawdata" 'Gy\\u0151r');
mh=$(match "$rawdata" 'Miskolc');
dh=$(match "$rawdata" 'Debrecen');
ph=$(match "$rawdata" 'P\\u00e9cs');
sh=$(match "$rawdata" 'Szeged \(Sz\\u0151reg\)');
zh=$(match "$rawdata" 'Si\\u00f3fok \(Balaton\)');
printf "\n"
printf "\033[0;32m .oydmmo:''.ohdo- \033[0m\n"
printf "\033[0;32m -mN+-'.+shhy+./dM: .-/o/ \033[0m\n"
printf "\033[0;32m .:NN. 'hMNMmmMmMy \033[0m\n"
printf "\033[0;32m :yNds/-+NMmh. '-' sMMN/ \033[0m\n"
printf "\033[0;32m .-////osNN-+dNMMm' 'dMhdy' \033[0m\n"
printf "\033[0;32m :hmds. 'yMh+osyo++. +/ '::sM- \033[0m\n"
printf "\033[0;32m :mM/:hMs- .Md \033[1;33m%s\033[0;32m +mM/ \033[0m\n" "$mh"
printf "\033[0;32m .oo/../Md :hNm+++oo+//ossyM/ .oyNmdMh- \033[0m\n"
printf "\033[0;32m hMMmMMMNmh /osy++oss+///. /sNmo+--' \033[0m\n"
printf "\033[0;32m .+sMN- \033[1;33m%s\033[0;32m -mMd. \033[0m\n" "$gh"
printf "\033[0;32m -/oMN' \033[1;33m%s\033[0;32m dM: \033[0m\n" "$bh"
printf "\033[0;32m dMh+/ \033[1;33m%s\033[0;32m 'mNd. \033[0m\n" "$dh"
printf "\033[0;32m mM/ hM/ \033[0m\n"
printf "\033[0;32m hMm .yMy \033[0m\n"
printf "\033[0;32m ohmMm +MN: \033[0m\n"
printf "\033[0;32m :NMm/:. \033[1;33m%s\033[0;32m .NMo \033[0m\n" "$zh"
printf "\033[0;32m /syMN' 'NN/ \033[0m\n"
printf "\033[0;32m .dMy -dMd \033[0m\n"
printf "\033[0;32m -dNo yMm+ \033[0m\n"
printf "\033[0;32m sMd+ 'MM- \033[0m\n"
printf "\033[0;32m '+mMh- \033[1;33m%s\033[0;32m - 'mMh' \033[0m\n" "$sh"
printf "\033[0;32m :NMo. \033[1;33m%s\033[0;32m . oMMMmMm+ \033[0m\n" "$ph"
printf "\033[0;32m '+hMd- yMNNmmMMMmdNNMNNm-'.- \033[0m\n"
printf "\033[0;32m /NN/ so'sh+hNNo ':- -.:/.-'-- \033[0m\n"
printf "\033[0;32m -dMNdmm+ .syMNNMyoo: \033[0m\n"
printf "\033[0;32m ...dMMs++//:.-+mNsy/-. \033[0m\n"
printf "\033[0;32m ./ysshydmNd+' \033[0m\n"
printf "\n"