From cf7a2c02071ac260331a8aebd36369fdd7d18b83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20Bora=CC=81ros?= Date: Tue, 4 Jun 2013 18:39:59 +0200 Subject: [PATCH] link to hydrostation --- Makefile | 9 +++++++-- data/.gitignore | 1 + index.haml | 8 +++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 1a643bb..e93510f 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,9 @@ VODASTATIONS=307225 307081 307228 VODAURL=http://hydro.chmi.cz/hpps/popup_hpps_prfdyn.php?seq=$(STATION) VODAIMG1=http://hydro.chmi.cz/hpps/tmp/img/big/$(STATION)_H.png VODAIMG2=http://hydro.chmi.cz/hpps/tmp/img/big/$(STATION)_Q.png +VODATMP=/tmp/voda.html VODAXPATH=//table[@class="stdstationtbl"]/./tr[3]//table/tr[position()>1] +VODANAMESXPATH=//table[@class="stdstationtbl"]/./tr[1]//table/./tr[2]/td/text() # option #2 #VODAURL=http://vvv.chmi.cz/hydro/detail_stanice/$(STATION).html @@ -28,8 +30,11 @@ get-voda = \ echo; echo *Station $(STATION)* ; \ wget '$(VODAIMG1)' -O data/stav_$(STATION).png_; \ wget '$(VODAIMG2)' -O data/prutok_$(STATION).png_; \ -wget '$(VODAURL)' -O - | $(XMLLINT) --encode utf8 - | $(XMLLINT) --xpath '$(VODAXPATH)' - > data/table_$(STATION).html_; \ -$(foreach FILE,data/stav_$(STATION).png data/prutok_$(STATION).png data/table_$(STATION).html,mv -v $(FILE)_ $(FILE);) +wget '$(VODAURL)' -O - | $(XMLLINT) --encode utf8 - > $(VODATMP); \ +$(XMLLINT) --xpath '$(VODAXPATH)' $(VODATMP) > data/table_$(STATION).html_; \ +$(XMLLINT) --xpath '$(VODANAMESXPATH)' $(VODATMP) > data/name_$(STATION).html_; \ +$(foreach FILE,stav_$(STATION).png prutok_$(STATION).png table_$(STATION).html name_$(STATION).html,mv -v data/$(FILE)_ data/$(FILE);) \ +rm $(VODATMP); all: index.html doprava.html pomoc.html kontakty.html diff --git a/data/.gitignore b/data/.gitignore index 238d3c7..2558209 100644 --- a/data/.gitignore +++ b/data/.gitignore @@ -3,3 +3,4 @@ doprava*.png prutok*.png stav*.png table*.html +name*.html diff --git a/index.haml b/index.haml index bfe74a4..87968b9 100644 --- a/index.haml +++ b/index.haml @@ -19,8 +19,14 @@ %li Kontakty .content + %p + - @stations.each do |station| + %a(href="##{station}") + =File.read("data/name_#{station}.html") + %br - @stations.each do |station| + %hr(id="#{station}") %table.twocolumn %tr %td(style="padding: 16px;") @@ -39,6 +45,6 @@ %th teplota [°C] =File.read("data/table_#{station}.html") - %hr + %hr .footer Data poskytuje Český hydrometeorologický ústav. Bez záruky.