2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-03 16:56:54 +00:00

SVGcache added

git-svn-id: https://svn.fhem.de/fhem/trunk@3250 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2013-06-06 16:31:29 +00:00
parent feb50058ba
commit 93739d13b3
2 changed files with 64 additions and 20 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII # Add changes at the top of the list. Keep it in ASCII
- SVN - SVN
- feature: FHEMWEB: SVGcache attribute & clearSvgCache set command added
- feature: SYSSTAT: allow (remote) monitoring raspberry pi on cpu frequency - feature: SYSSTAT: allow (remote) monitoring raspberry pi on cpu frequency
- feature: MANTAINER.txt added - feature: MANTAINER.txt added
- feature: PRESENCE: new mode "shellscript" to use own - feature: PRESENCE: new mode "shellscript" to use own
@ -8,7 +9,7 @@
- feature: PRESENCE: new attribute ping_count - feature: PRESENCE: new attribute ping_count
- feature: userReadings may have a filter - feature: userReadings may have a filter
- feature: HUEBridge: allow starting of bridge firmware update - feature: HUEBridge: allow starting of bridge firmware update
- change: EnOcean: profil PM101 changed, old profiles FAH, FBH, FTF, SR04 - change: EnOcean: profile PM101 changed, old profiles FAH, FBH, FTF, SR04
removed removed
- feature: TCM: new attr blockSenderID: - feature: TCM: new attr blockSenderID:
Block receiving telegrams with a TCM SenderID sent by repeaters Block receiving telegrams with a TCM SenderID sent by repeaters

View File

@ -119,7 +119,7 @@ FHEMWEB_Initialize($)
"stylesheetPrefix touchpad:deprecated smallscreen:deprecated ". "stylesheetPrefix touchpad:deprecated smallscreen:deprecated ".
"basicAuth basicAuthMsg hiddenroom hiddengroup HTTPS allowfrom CORS:0,1 ". "basicAuth basicAuthMsg hiddenroom hiddengroup HTTPS allowfrom CORS:0,1 ".
"refresh longpoll:1,0 redirectCmds:0,1 reverseLogs:0,1 menuEntries ". "refresh longpoll:1,0 redirectCmds:0,1 reverseLogs:0,1 menuEntries ".
"roomIcons"; "roomIcons SVGcache";
############### ###############
# Initialize internal structures # Initialize internal structures
@ -1519,12 +1519,31 @@ FW_showLog($)
Log 1, $ret if($ret); Log 1, $ret if($ret);
} }
Log 5, "plotcommand: get $d $file INT $f $t " . join(" ", @{$flog}); Log 5, "plotcommand: get $d $file INT $f $t " . join(" ", @{$flog});
$ret = FW_fC("get $d $file INT $f $t " . join(" ", @{$flog}));
($cfg, $plot) = FW_substcfg(1, $wl, $cfg, $plot, $file, "<OuT>");
FW_pO SVG_render($wl, $f, $t, $cfg,
$internal_data, $plot, $FW_wname, $FW_cssdir);
$FW_RETTYPE = "image/svg+xml"; $FW_RETTYPE = "image/svg+xml";
my $SVGcache = (AttrVal($FW_wname, "SVGcache", undef) && $t lt TimeNow());
my $cDir = "$FW_dir/SVGcache";
my $cName = "$cDir/$wl-$f-$t.svg";
if($SVGcache && open(CFH, $cName)) {
FW_pO join("", <CFH>);
close(CFH);
} else {
FW_fC("get $d $file INT $f $t " . join(" ", @{$flog}));
($cfg, $plot) = FW_substcfg(1, $wl, $cfg, $plot, $file, "<OuT>");
$ret = SVG_render($wl, $f, $t, $cfg,
$internal_data, $plot, $FW_wname, $FW_cssdir);
FW_pO $ret;
if($SVGcache) {
mkdir($cDir) if(! -d $cDir);
if(open(CFH, ">$cName")) {
print CFH $ret;
close(CFH);
}
}
}
} }
} }
@ -2434,15 +2453,27 @@ sub
FW_Set($@) FW_Set($@)
{ {
my ($hash, @a) = @_; my ($hash, @a) = @_;
my %cmd = ("rereadicons" => 1, "clearSvgCache" => 1);
return "no set value specified" if(@a < 2); return "no set value specified" if(@a < 2);
return "Unknown argument $a[1], choose one of " . "rereadicons" return ("Unknown argument $a[1], choose one of ".join(" ", sort keys %cmd))
unless($a[1] eq "rereadicons"); if(!$cmd{$a[1]});
my @dirs = keys %FW_icons; if($a[1] eq "rereadicons") {
%FW_icons = (); my @dirs = keys %FW_icons;
foreach my $d (@dirs) { %FW_icons = ();
FW_readIcons($d); foreach my $d (@dirs) {
FW_readIcons($d);
}
}
if($a[1] eq "clearSvgCache") {
my $cDir = "$FW_dir/SVGcache";
if(opendir(DH, $cDir)) {
map { my $n="$cDir/$_"; unlink($n) if(-f $n); } readdir(DH);;
closedir(DH);
} else {
return "Can't open $cDir: $!";
}
} }
return undef; return undef;
} }
@ -2585,13 +2616,16 @@ FW_dropdownFn()
<a name="FHEMWEBset"></a> <a name="FHEMWEBset"></a>
<b>Set</b> <b>Set</b>
<ul> <ul>
<code>set &lt;name&gt; rereadicons</code> <li>rereadicons<br>
<br><br> Rereads the icons in the icon path and updates the mapping from logical
Rereads the icons in the icon path and updates the mapping from logical icons to physical files. icons to physical files. Use after adding, deleting or changing icons.
Use after adding, deleting or changing icons. </li>
<br><br> <li>clearSvgCache<br>
Delete all files found in the www/SVGcache directory, which is used to
cache SVG data, if the SVGcache attribute is set.
</li>
</ul> </ul>
<br>
<a name="FHEMWEBget"></a> <a name="FHEMWEBget"></a>
<b>Get</b> <b>Get</b>
@ -2605,7 +2639,8 @@ FW_dropdownFn()
</code> </code>
</ul> </ul>
<li>pathlist<br> <li>pathlist<br>
return FHEMWEB specific directories, where files for given types are located return FHEMWEB specific directories, where files for given types are
located
<br><br> <br><br>
</ul> </ul>
@ -2664,6 +2699,14 @@ FW_dropdownFn()
smallscreen. smallscreen.
</li><br> </li><br>
<a name="SVGcache"></a>
<li>SVGcache<br>
if set, cache plots which won't change any more (the end-date is prior
to the current timestamp). The files are written to the www/SVGcache
directory. Default is off.<br>
See also the clearSvgCache command for clearing the cache.
</li><br>
<a name="fixedrange"></a> <a name="fixedrange"></a>
<li>fixedrange<br> <li>fixedrange<br>
Can be applied to weblink devices (FHEMWEB).<br> Can be applied to weblink devices (FHEMWEB).<br>