bugfix for background selection in 02_RSS.pm

git-svn-id: https://svn.fhem.de/fhem/trunk@1406 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert
2012-04-03 20:44:14 +00:00
parent 5b678e1737
commit 1ffc2aa967

View File

@@ -321,10 +321,16 @@ RSS_returnJPEG($) {
# #
# set the background # set the background
# #
my $bgdir= AttrVal($name,"bg","");
my $bgnr= 0; # item number
# check if background directory is set # check if background directory is set
my $bgdir= AttrVal($name,"bg","");
goto SKIPBG unless($bgdir ne ""); goto SKIPBG unless($bgdir ne "");
my $bgnr; # item number
if(defined($defs{$name}{fhem}) && defined($defs{$name}{fhem}{bgnr})) {
$bgnr= $defs{$name}{fhem}{bgnr};
} else {
$bgnr= 0;
}
# check if at least tmin seconds have passed # check if at least tmin seconds have passed
my $t0= 0; my $t0= 0;
my $tmin= AttrVal($name,"tmin",0); my $tmin= AttrVal($name,"tmin",0);
@@ -334,9 +340,7 @@ RSS_returnJPEG($) {
my $t1= time(); my $t1= time();
if($t1-$t0>= $tmin) { if($t1-$t0>= $tmin) {
$defs{$name}{fhem}{t}= $t1; $defs{$name}{fhem}{t}= $t1;
if(defined($defs{$name}{fhem}) && defined($defs{$name}{fhem}{bgnr})) { $bgnr++;
$bgnr= $defs{$name}{fhem}{bgnr}+1;
}
} }
# detect pictures # detect pictures
goto SKIPBG unless(opendir(BGDIR, $bgdir)); goto SKIPBG unless(opendir(BGDIR, $bgdir));