summaryrefslogtreecommitdiffstats
path: root/kachelmann
diff options
context:
space:
mode:
Diffstat (limited to 'kachelmann')
-rw-r--r--kachelmann/Makefile11
-rwxr-xr-x[-rw-r--r--]kachelmann/changes8
-rwxr-xr-xkachelmann/wetter6
3 files changed, 15 insertions, 10 deletions
diff --git a/kachelmann/Makefile b/kachelmann/Makefile
index 7fa3ec2d..3343d941 100644
--- a/kachelmann/Makefile
+++ b/kachelmann/Makefile
@@ -1,8 +1,7 @@
.PHONY: infect
-INSTALL_DIR = /root/bin/
-infect:
- mkdir -p /tmp/kachelmann/
- cp conditions ${INSTALL_DIR}
- mv ${INSTALL_DIR}conditions ${INSTALL_DIR}kachelmann
- chmod +x ${INSTALL_DIR}kachelmann
+install:
+ # punani -Ei w3m php php-xml-simple
+ ln -s $$PWD/conditions ../bin/conditions
+ ln -s $$PWD/wetter ../bin/wetter
+ ln -s ${INSTALL_DIR}conditions ${INSTALL_DIR}kachelmann
diff --git a/kachelmann/changes b/kachelmann/changes
index 1875dabd..22116967 100644..100755
--- a/kachelmann/changes
+++ b/kachelmann/changes
@@ -10,15 +10,15 @@ my $condition_store = undef;
my $data_old = $condition_store;
while (1) {
&xml_update();
+ $data_old = $data_new;
$data_new = $condition_store;
- if($data_new == $data_old){
- system("espeak Das Wetter hat sich von $data_old in $data_new verändert");
+ if($data_new ne $data_old){
+ system("espeak \"Das Wetter hat sich von $data_old in $data_new verändert\n\"");
}
sleep 300;
- $data_new = $data_old;
}
sub xml_update(){
- $xml_store = system("w3m -dump \"http://www.google.com/ig/api?weather=70327-stuttgart&hl=de\"");
+ $xml_store = `w3m -dump "http://www.google.com/ig/api?weather=70327-stuttgart&hl=de"`;
$xml_store = $xml->XMLin($xml_store);
$condition_store = $xml_store->{weather}->{current_conditions}->{condition}->{data};
}
diff --git a/kachelmann/wetter b/kachelmann/wetter
new file mode 100755
index 00000000..957e13e2
--- /dev/null
+++ b/kachelmann/wetter
@@ -0,0 +1,6 @@
+#!/usr/bin/perl
+use XML::Simple;
+my $result = `w3m -dump "http://www.google.com/ig/api?weather=70327-stuttgart&hl=de"`;
+my $xml = new XML::Simple;
+my $data = $xml->XMLin($result);
+print ("$data->{weather}->{current_conditions}->{condition}->{data} bei $data->{weather}->{current_conditions}->{temp_c}->{data} Grad Zelsius\n");