diff --git a/.gitignore b/.gitignore
index 8eb1279..5defd3a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ doprava.html
index.html
kontakty.html
pomoc.html
+cesty.html
diff --git a/Makefile b/Makefile
index 57bfc9d..3c36e0d 100644
--- a/Makefile
+++ b/Makefile
@@ -25,8 +25,33 @@ DOPRAVAURL=http://www.dpp.cz/povodne-aktualni-doprava/
DOPRAVATMP=/tmp/doprava.html
DOPRAVAXPATH1=string((//div[@id="content-container"]/div[@id="pole"]/div/div[2]//a[starts-with(@title,"Stav dopravy k")]/@href)[last()])
DOPRAVAXPATH2=//div[@id="content-container"]/div[@id="pole"]/div/div[2]//*[@class="img-c img-envelope"]/../preceding-sibling::*
+DOPRAVAXPATH3=//div[@id="pole"]//*[starts-with(text(),"Stav městské")]/following-sibling::*
+
+CESTYURL=http://www.praha.eu/jnp/cz/home/magistrat/tiskovy_servis/tiskove_zpravy/prehled_uzavrenych_komunikaci.html
+CESTYXPATH=string(//div[@id="content"]//a[text() = "Mapka"]/@href)
# function
+get-doprava = \
+echo ; echo Doprava ; \
+wget $(DOPRAVAURL) -O - | $(XMLLINT) --encode utf8 - > $(DOPRAVATMP) ; \
+wget $$($(XMLLINT) --html --xpath '$(DOPRAVAXPATH1)' $(DOPRAVATMP)) -O - | convert -density 150 - data/doprava_.png && mogrify -resize 1200x1200 data/doprava_.png ; \
+$(XMLLINT) --xpath '$(DOPRAVAXPATH2)' $(DOPRAVATMP) > data/doprava_.html ; \
+mv data/doprava_.png data/doprava.png && mv data/doprava_.html data/doprava.html ; \
+rm $(DOPRAVATMP) ; \
+
+get-doprava-noimg = \
+echo ; echo Doprava ; \
+wget $(DOPRAVAURL) -O - | $(XMLLINT) --encode utf8 - > $(DOPRAVATMP) ; \
+$(XMLLINT) --xpath '$(DOPRAVAXPATH3)' $(DOPRAVATMP) > data/doprava_.html ; \
+echo "Doprava byla obnovena." | convert -background none -undercolor lightblue -fill blue -pointsize 18 text:- -trim +repage -bordercolor lightblue -page 1200x95+500+10 -background lightblue -flatten data/doprava_.png ; \
+mv data/doprava_.png data/doprava.png && mv data/doprava_.html data/doprava.html ; \
+rm $(DOPRAVATMP) ; \
+
+get-cesty = \
+echo ; echo Cesty ; \
+wget $$($(XMLLINT) --xpath '$(CESTYXPATH)' $(CESTYURL)) -O - | convert -density 150 - data/cesty_.png && mogrify -resize 1500x1500 data/cesty_.png ; \
+mv data/cesty_.png data/cesty.png ; \
+
get-voda = \
echo; echo *Station $(STATION)* ; \
wget '$(VODAIMG1)' -O data/stav_$(STATION).png_; \
@@ -38,18 +63,17 @@ $(XMLLINT) --xpath '$(VODANAMESXPATH)' $(VODATMP) > data/name_$(STATION).html_;
$(foreach FILE,stav_$(STATION).png prutok_$(STATION).png table_$(STATION).html name_$(STATION).html legend_$(STATION).html,mv -v data/$(FILE)_ data/$(FILE);) \
rm $(VODATMP);
-all: index.html doprava.html pomoc.html kontakty.html
+all: index.html doprava.html pomoc.html kontakty.html cesty.html
refresh:
$(foreach STATION,$(VODASTATIONS), $(call get-voda) )
sed -i 's/@stations\s*=.*/@stations=[$(foreach STATION,$(VODASTATIONS), $(STATION)\, )]/' index.haml
refreshdpp:
- wget $(DOPRAVAURL) -O - | $(XMLLINT) --encode utf8 - > $(DOPRAVATMP)
- wget $$($(XMLLINT) --html --xpath '$(DOPRAVAXPATH1)' $(DOPRAVATMP)) -O - | convert -density 150 - data/doprava_.png && mogrify -resize 1200x1200 data/doprava_.png
- $(XMLLINT) --xpath '$(DOPRAVAXPATH2)' $(DOPRAVATMP) > data/doprava_.html
- mv data/doprava_.png data/doprava.png && mv data/doprava_.html data/doprava.html
- rm $(DOPRAVATMP)
+ $(call get-doprava-noimg)
+
+refreshcesty:
+ $(call get-cesty)
%.html: %.haml
$(HAML) $< $@
diff --git a/cesty.haml b/cesty.haml
new file mode 100644
index 0000000..0c04f49
--- /dev/null
+++ b/cesty.haml
@@ -0,0 +1,24 @@
+!!! 5
+%html
+ %head
+ %meta(charset="utf-8")
+ %link(rel="icon" type="image/png" href="favicon.png")
+ %link(rel="stylesheet" type="text/css" href="style.css")
+ %title Povodeň - Doprava
+ %body
+
+ %ul#navbar
+ %li.logo
+ %li Voda
+ %li Doprava
+ %li.active Cesty
+ %li Nabídky pomoci
+ %li Kontakty
+
+ .content
+
+ #imgdoprava
+ %img(src="data/cesty.png" style="width: 100%; max-width: 1500px;")
+
+ %hr
+ .footer Data poskytuje Magistrát hl. m. Prahy. Bez záruky.
diff --git a/doprava.haml b/doprava.haml
index 89a3aec..13ca4c2 100644
--- a/doprava.haml
+++ b/doprava.haml
@@ -11,6 +11,7 @@
%li.logo
%li Voda
%li.active Doprava
+ %li Cesty
%li Nabídky pomoci
%li Kontakty
diff --git a/index.haml b/index.haml
index 82fcc34..04ef61f 100644
--- a/index.haml
+++ b/index.haml
@@ -15,6 +15,7 @@
%li.logo
%li.active Voda
%li Doprava
+ %li Cesty
%li Nabídky pomoci
%li Kontakty
diff --git a/kontakty.haml b/kontakty.haml
index 556f082..d9176d8 100644
--- a/kontakty.haml
+++ b/kontakty.haml
@@ -11,6 +11,7 @@
%li.logo
%li Voda
%li Doprava
+ %li Cesty
%li Nabídky pomoci
%li.active Kontakty
diff --git a/pomoc.haml b/pomoc.haml
index 93797cc..96c4ae8 100644
--- a/pomoc.haml
+++ b/pomoc.haml
@@ -11,6 +11,7 @@
%li.logo
%li Voda
%li Doprava
+ %li Cesty
%li.active Nabídky pomoci
%li Kontakty