diff options
Diffstat (limited to 'kachelmann')
-rw-r--r-- | kachelmann/.gitignore | 2 | ||||
-rw-r--r-- | kachelmann/Makefile | 8 | ||||
-rw-r--r-- | kachelmann/changes | 24 | ||||
-rwxr-xr-x | kachelmann/conditions | 6 |
4 files changed, 40 insertions, 0 deletions
diff --git a/kachelmann/.gitignore b/kachelmann/.gitignore new file mode 100644 index 00000000..050dfb2e --- /dev/null +++ b/kachelmann/.gitignore @@ -0,0 +1,2 @@ +conditions.pl +.*.swp diff --git a/kachelmann/Makefile b/kachelmann/Makefile new file mode 100644 index 00000000..7fa3ec2d --- /dev/null +++ b/kachelmann/Makefile @@ -0,0 +1,8 @@ +.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 + diff --git a/kachelmann/changes b/kachelmann/changes new file mode 100644 index 00000000..1875dabd --- /dev/null +++ b/kachelmann/changes @@ -0,0 +1,24 @@ +#!/usr/bin/perl +use XML::Simple; +my $xml = new XML::Simple; +my $xml_store = undef; +my $data_new = undef; +my $data_old = undef; +my $condition_store = undef; + + +my $data_old = $condition_store; +while (1) { + &xml_update(); + $data_new = $condition_store; + if($data_new == $data_old){ + system("espeak Das Wetter hat sich von $data_old in $data_new verändert"); + } + 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 = $xml->XMLin($xml_store); + $condition_store = $xml_store->{weather}->{current_conditions}->{condition}->{data}; +} diff --git a/kachelmann/conditions b/kachelmann/conditions new file mode 100755 index 00000000..ea4ba5ca --- /dev/null +++ b/kachelmann/conditions @@ -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 ("Die Wetterkondition ist: $data->{weather}->{current_conditions}->{condition}->{data}\n bei $data->{weather}->{current_conditions}->{temp_c}->{data} Grad Zelsius\n"); |