2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-08 07:24:21 +00:00

: minor code cleanup

git-svn-id: https://svn.fhem.de/fhem/trunk@21557 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
betateilchen 2020-03-31 12:20:27 +00:00
parent e90f0aad81
commit 6fc2397eef

View File

@ -133,15 +133,17 @@ sub btIP_getURL;
###################################### ######################################
sub InfoPanel_Initialize($) { sub InfoPanel_Initialize {
my ($hash) = @_; my ($hash) = @_;
## no critic
eval "use MIME::Base64" ; eval "use MIME::Base64" ;
$useImgTools = 0 if($@); $useImgTools = 0 if($@);
Log3(undef,4,"InfoPanel: MIME::Base64 missing.") unless $useImgTools; Log3(undef,4,"InfoPanel: MIME::Base64 missing.") unless $useImgTools;
eval "use Image::Info qw(image_info dim)"; eval "use Image::Info qw(image_info dim)";
$useImgTools = 0 if($@); $useImgTools = 0 if($@);
Log3(undef,4,"InfoPanel: Image::Info missing.") unless $useImgTools; Log3(undef,4,"InfoPanel: Image::Info missing.") unless $useImgTools;
## use critic
$hash->{DefFn} = "btIP_Define"; $hash->{DefFn} = "btIP_Define";
$hash->{UndefFn} = "btIP_Undef"; $hash->{UndefFn} = "btIP_Undef";
@ -529,7 +531,8 @@ sub btIP_itemLine {
sub btIP_itemLongpoll { sub btIP_itemLongpoll {
my ($id,$x,$y,$text,%params)= @_; my ($id,$x,$y,$text,%params)= @_;
my ($iconName,undef,undef) = FW_dev2image($id); my ($iconName,undef,undef) = FW_dev2image($id);
my $iconURL = FW_IconURL($iconName) if defined($iconName); my $iconURL;
$iconURL = FW_IconURL($iconName) if defined($iconName);
my $color = substr($params{rgb},0,6); my $color = substr($params{rgb},0,6);
my $opacity = hex(substr($params{rgb},6,2))/255; my $opacity = hex(substr($params{rgb},6,2))/255;
my $output = "<div informId=\"$id\" style=\"position:absolute; top:${y}px; left:${x}px; "; my $output = "<div informId=\"$id\" style=\"position:absolute; top:${y}px; left:${x}px; ";
@ -779,10 +782,10 @@ sub btIP_FileRead {
if(!$counter) { if(!$counter) {
Log3(undef,4,"InfoPanel: reading from filesystem"); Log3(undef,4,"InfoPanel: reading from filesystem");
my $length = -s "$file"; my $length = -s "$file";
open(GRAFIK, "<", $file) or die("File not found $!"); open(my $GRAFIK, "<", $file) or die("File not found $!");
binmode(GRAFIK); binmode($GRAFIK);
$counter = read(GRAFIK, $data, $length); $counter = read($GRAFIK, $data, $length);
close(GRAFIK); close($GRAFIK);
Log3(undef,4,"InfoPanel: file not found in filesystem") unless $counter; Log3(undef,4,"InfoPanel: file not found in filesystem") unless $counter;
} }
return "" unless $counter; return "" unless $counter;