2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-03-10 09:16:53 +00:00

02_RSS: use a GUID in RSS; urlq source for img command

git-svn-id: https://svn.fhem.de/fhem/trunk@6983 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
borisneubert 2014-11-15 15:39:52 +00:00
parent 369ad2e219
commit a0348d73a8
2 changed files with 12 additions and 5 deletions

View File

@ -1,5 +1,6 @@
# Add changes at the top of the list. Keep it in ASCII, and 80-char wide. # Add changes at the top of the list. Keep it in ASCII, and 80-char wide.
# Do not insert empty lines here, update check depends on it. # Do not insert empty lines here, update check depends on it.
- change: 02_RSS: use a GUID in RSS; urlq source for img command
- feature: 70_PushNotifier improve usebility, configuration without cURL (xusader) - feature: 70_PushNotifier improve usebility, configuration without cURL (xusader)
- bugfix: SYSMON: prevent empty line im log by userReadings - bugfix: SYSMON: prevent empty line im log by userReadings
- feature: 10_IT empfang (by bjoernh) - feature: 10_IT empfang (by bjoernh)

View File

@ -218,7 +218,8 @@ RSS_returnRSS($) {
my $url= RSS_getURL($defs{$name}{fhem}{hostname}); my $url= RSS_getURL($defs{$name}{fhem}{hostname});
my $type = $defs{$name}{fhem}{style}; my $type = $defs{$name}{fhem}{style};
my $mime = ($type eq 'png')? 'image/png' : 'image/jpeg'; my $mime = ($type eq 'png')? 'image/png' : 'image/jpeg';
my $code= "<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'><channel><title>$name</title><ttl>1</ttl><item><media:content url='$url/rss/$name.$type' type='$mime'/></item></channel></rss>"; my $now = time();
my $code = "<rss version='2.0' xmlns:media='http://search.yahoo.com/mrss/'><channel><title>$name</title><ttl>1</ttl><item><media:content url='$url/rss/$name.$type' type='$mime'/><guid isPermaLink='false'>item_$now</guid></item></channel></rss>";
return ("application/xml; charset=utf-8", $code); return ("application/xml; charset=utf-8", $code);
} }
@ -363,8 +364,13 @@ RSS_itemImg {
return unless(defined($arg)); return unless(defined($arg));
return if($arg eq ""); return if($arg eq "");
my $I; my $I;
if($srctype eq "url" || $srctype eq "urlq") {
my $data;
if($srctype eq "url") { if($srctype eq "url") {
my $data = GetFileFromURL($arg,3,undef,1); $data= GetFileFromURL($arg,3,undef,1);
} else {
$data= GetFileFromURLQuiet($arg,3,undef,1);
}
if($imgtype eq "gif") { if($imgtype eq "gif") {
$I= GD::Image->newFromGifData($data); $I= GD::Image->newFromGifData($data);
} elsif($imgtype eq "png") { } elsif($imgtype eq "png") {
@ -986,8 +992,8 @@ RSS_CGI(){
<li>img &lt;x&gt; &lt;y&gt; &lt;['w' or 'h']s&gt; &lt;imgtype&gt; &lt;srctype&gt; &lt;arg&gt; <br>Renders a picture at the <li>img &lt;x&gt; &lt;y&gt; &lt;['w' or 'h']s&gt; &lt;imgtype&gt; &lt;srctype&gt; &lt;arg&gt; <br>Renders a picture at the
position (&lt;x&gt;, &lt;y&gt;). The &lt;imgtype&gt; is one of <code>gif</code>, <code>jpeg</code>, <code>png</code>. position (&lt;x&gt;, &lt;y&gt;). The &lt;imgtype&gt; is one of <code>gif</code>, <code>jpeg</code>, <code>png</code>.
The picture is scaled by the factor &lt;s&gt; (a decimal value). If 'w' or 'h' is in front of scale-value the value is used to set width or height to the value in pixel. If &lt;srctype&gt; is <code>file</code>, the picture The picture is scaled by the factor &lt;s&gt; (a decimal value). If 'w' or 'h' is in front of scale-value the value is used to set width or height to the value in pixel. If &lt;srctype&gt; is <code>file</code>, the picture
is loaded from the filename &lt;arg&gt;, if &lt;srctype&gt; is <code>url</code>, the picture is loaded from the filename &lt;arg&gt;, if &lt;srctype&gt; is <code>url</code> or <code>urlq</code>, the picture
is loaded from the URL &lt;arg&gt;, if &lt;srctype&gt; is <code>data</code>, the picture is loaded from the URL &lt;arg&gt; (with or without logging the URL), if &lt;srctype&gt; is <code>data</code>, the picture
is piped in from data &lt;arg&gt;. You can use is piped in from data &lt;arg&gt;. You can use
<code>{ <a href="#perl">&lt;perl special&gt;</a> }</code> for &lt;arg&gt. See below for example. <code>{ <a href="#perl">&lt;perl special&gt;</a> }</code> for &lt;arg&gt. See below for example.
Notice: do not load the image from URL that is served by fhem as it leads to a deadlock.<br></li> Notice: do not load the image from URL that is served by fhem as it leads to a deadlock.<br></li>