diff --git a/fhem/CHANGED b/fhem/CHANGED index 88ef72f6c..23c21832c 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -21,6 +21,7 @@ - feature: remove dependency on Google::Weather, major rewrite (Boris) - feature: started experimental interface implementation (fhem API v2) (Boris) - feature: sleep issued in at/notify/etc is not blocking fhem anymore + - feature: new module 02_RSS.pm - 2011-12-31 (5.2) diff --git a/fhem/FHEM/02_RSS.pm b/fhem/FHEM/02_RSS.pm index 0abcbc3be..a7cdd1517 100644 --- a/fhem/FHEM/02_RSS.pm +++ b/fhem/FHEM/02_RSS.pm @@ -197,6 +197,14 @@ RSS_returnRSS($) { # Library ################## +sub +RSS_xy($$$) { + my ($S,$x,$y)= @_; + if($x<1) { $x*= $S->width; } + if($y<1) { $y*= $S->height; } + return($x,$y); +} + sub RSS_color { my ($S,$rgb)= @_; @@ -207,8 +215,7 @@ RSS_color { sub RSS_itemText { my ($S,$x,$y,$text,%params)= @_; - if($x<1) { $x*= $S->width; } - if($y<1) { $y*= $S->height; } + ($x,$y)= RSS_xy($S,$x,$y); $S->stringFT(RSS_color($S,$params{rgb}),$params{font},$params{pt},0,$x,$y,$text); } @@ -219,6 +226,20 @@ RSS_itemTime { RSS_itemText($S,$x,$y,sprintf("%02d:%02d", $hour, $min),%params); } +sub +RSS_itemGif { + my ($S,$x,$y,$host,$filename,%params)= @_; + return if($host eq ""); + return if($filename eq ""); + ($x,$y)= RSS_xy($S,$x,$y); + my $data = GetHttpFile($host,$filename); + return unless(defined($data)); + my $I= GD::Image->newFromGifData($data); + my ($width,$height)= $I->getBounds(); + Log 5, "RSS placing $host$filename ($width x $height) at ($x,$y)"; + $S->copy($I,$x,$y,0,0,$width,$height); +} + ################## sub @@ -232,7 +253,7 @@ RSS_evalLayout($$@) { $params{pt}= 12; $params{rgb}= "ffffff"; - my ($x,$y, $text); + my ($x,$y,$text,$host,$filename); my $cont= ""; foreach my $line (@layout) { @@ -263,6 +284,10 @@ RSS_evalLayout($$@) { } elsif($cmd eq "time") { ($x,$y)= split("[ \t]+", $def, 2); RSS_itemTime($S,$x,$y,%params); + } elsif($cmd eq "gif") { + ($x,$y,$host,$filename)= split("[ \t]+", $def,4); + my $fn= AnalyzePerlCommand(undef, $filename); + RSS_itemGif($S,$x,$y,$host,$fn,%params); } else { Log 1, "$name: Illegal command $cmd in layout definition."; } diff --git a/fhem/docs/commandref.html b/fhem/docs/commandref.html index 7c0298d0f..ccf6db735 100644 --- a/fhem/docs/commandref.html +++ b/fhem/docs/commandref.html @@ -5209,7 +5209,8 @@ Attributes:
Layout control commands This is how a layout definition might look like:

@@ -5240,6 +5245,7 @@ Attributes:
time 0.10 0.90
pt 24
text 0.10 0.95 { ReadingsVal("MyWeather","temperature","?"). "°C" }
+ gif 20 530 www.google.com:80 { ReadingsVal("e.ext.Weather","icon","") }