X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/0ec2c55ac097d28032fefe7f898db46b0eba305d..b471a06f45f8bf9c2da21b42e666b081d16724a8:/IkiWiki/Plugin/aggregate.pm diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 05e22a290..01e026c88 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -513,7 +513,10 @@ sub aggregate (@) { } $feed->{feedurl}=pop @urls; } - my $ua=useragent(); + # Using the for_url parameter makes sure we crash if used + # with an older IkiWiki.pm that didn't automatically try + # to use LWPx::ParanoidAgent. + my $ua=useragent(for_url => $feed->{feedurl}); my $res=URI::Fetch->fetch($feed->{feedurl}, UserAgent=>$ua); if (! $res) { $feed->{message}=URI::Fetch->errstr; @@ -587,6 +590,10 @@ sub aggregate (@) { title => defined $entry->title ? decode_entities($entry->title) : "untitled", author => defined $entry->author ? decode_entities($entry->author) : "", link => $entry->link, + enclosureurl => defined $entry->enclosure ? $entry->enclosure->url : "", + enclosureimage => (defined $entry->enclosure && $entry->enclosure->type =~ m/image\//) ? "1" : "", + enclosureaudio => (defined $entry->enclosure && $entry->enclosure->type =~ m/audio\//) ? "1" : "", + enclosurevideo => (defined $entry->enclosure && $entry->enclosure->type =~ m/video\//) ? "1" : "", content => (defined $c && defined $c->body) ? $c->body : "", guid => defined $entry->id ? $entry->id : time."_".$feed->{name}, ctime => $entry->issued ? ($entry->issued->epoch || time) : time, @@ -697,6 +704,14 @@ sub write_page ($$$$$) { if defined $params{copyright} && length $params{copyright}; $template->param(permalink => IkiWiki::urlabs($params{link}, $feed->{feedurl})) if defined $params{link}; + $template->param(enclosureurl => $params{enclosureurl}) + if defined $params{enclosureurl} && length $params{enclosureurl}; + $template->param(enclosureimage => $params{enclosureimage}) + if defined $params{enclosureimage} && length $params{enclosureimage}; + $template->param(enclosureaudio => $params{enclosureaudio}) + if defined $params{enclosureaudio} && length $params{enclosureaudio}; + $template->param(enclosurevideo => $params{enclosurevideo}) + if defined $params{enclosurevideo} && length $params{enclosurevideo}; if (ref $feed->{tags}) { $template->param(tags => [map { tag => $_ }, @{$feed->{tags}}]); }