rss2leafnode
view release on metacpan or search on metacpan
devel/icons.pl view on Meta::CPAN
use warnings;
use LWP::UserAgent;
use List::Util 'max','min';
use POSIX ();
use Locale::TextDomain 1.17;
use Locale::TextDomain ('App-RSS2Leafnode');
use Smart::Comments;
{
require Image::Magick;
open my $fh, '<', '/tmp/favicon.ico' or die;
my $bytes = do { local $/; <$fh> }; # slurp
close $fh or die;
my $im = Image::Magick->new (magick => 'ico');
my @info = $im->Ping(blob=>$bytes);
### @info
@info = $im->Ping('/tmp/xx');
### @info
@info = $im->Ping('/tmp/favicon.ico');
### @info
exit 0;
}
{
require Image::Magick;
my $im = Image::Magick->new;
# $im->Read('/usr/share/icons/hicolor/48x48/apps/emacs.png');
my $ret = $im->Read('/tmp/favicon.icoxxy');
### $ret
# open my $fh, '<', '/tmp/favicon.ico' or die;
# my $bytes = do { local $/; <$fh> }; # slurp
# close $fh or die;
# my $im = Image::Magick->new (mime=>'image/x-icon');
# # $im->Set(mime=>'image/x-ico');
# # 'image/vnd.microsoft.icon'
# # my $im = Image::Magick->new (magick=>'ico');
# my $ret = $im->BlobToImage ($bytes);
# ### $ret
# $im->Set(magick => 'xbm');
# # $im->Set(-compress => 'none');
# $im->Write('/tmp/x.xbm');
# system('cat /tmp/x.xbm');
exit 0;
}
devel/icons.pl view on Meta::CPAN
my $self = bless({verbose=>2},'main');
my $url = "file://$ENV{HOME}/tux/web/ch"."art/index.html";
my $resp = $ua->get($url);
### favicon: resp_favicon_uri($resp)
### face: $self->resp_face($resp)
exit 0;
}
# sub image_size {
# if (eval { require Image::ExifTool }) {
# } elsif (eval { require Image::Magick }) {
# }
sub imagemagick_to_x_face {
my ($self, $type, $data) = @_;
eval { require Image::XFace } or return;
### $type
my $image = $self->imagemagick_from_data($type,$data) || return;
# $xface = Image::XFace::compface(@bits);
return;
}
lib/App/RSS2Leafnode.pm view on Meta::CPAN
}
### compress: $image->Get('compression')
# $image->Write ('/tmp/x.png');
($data) = $image->ImageToBlob ();
return $data;
}
# $type is "png", "ico" etc, $data is an image in a byte string
# return a Image::Magick object, or undef if Perl-Magick not available
sub imagemagick_from_data {
my ($self, $type, $data) = @_;
### imagemagick_from_data(): $type
eval { require Image::Magick } or return;
my $image = Image::Magick->new (magick=>$type);
# $image->Set(debug=>'All');
my $ret = $image->BlobToImage ($data);
### ret: "$ret"
### ret: $ret+0
if ($ret == 1) {
return $image;
}
# try again without the $type forced, in case bad Content-Type from http
$image = Image::Magick->new;
# $image->Set(debug=>'All');
$ret = $image->BlobToImage ($data);
### ret: "$ret"
### ret: $ret+0
if ($ret == 1) {
return $image;
}
print __x(" imagemagick doesn't like image data ({length} bytes) from {url}: {error}\n",
length => length($data),
rss2leafnode view on Meta::CPAN
wrapping Atom text. You can set this to whatever you find easiest to read,
or any special width needed by a particular feed.
=item $get_icon (default 0)
=item C<fetch_rss ("group", "url", get_icon =E<gt> G)>
=item C<fetch_html ("group", "url", get_icon =E<gt> G)>
Download an RSS/Atom icon or HTML favicon as an image for the C<Face>
header. C<Image::Magick> is required for image processing if not already
PNG format and maximum size 48x48 (in size attributes).
The C<Face> header is shown by Gnus and perhaps only a few other
news readers. In Gnus it appears with "From:" in article mode on a
graphical screen. It can be a good visual cue to the origin, but may not
always be worth the extra download.
$get_icon = 1;
fetch_rss ('r2l.whatsnew',
'http://www.archive.org/services/collection-rss.php');
rss2leafnode view on Meta::CPAN
Defaults per C<Net::NNTP> and C<Net::Config>.
=back
=head1 SEE ALSO
L<leafnode(8)>,
L<HTML::FormatText>, L<HTML::FormatText::WithLinks>, L<HTML::FormatExternal>,
L<lynx(1)>,
L<URI::Title>, L<XML::Parser>, L<XML::Liberal>, L<Image::Magick>,
C<Net::NNTP>, C<Net::Config>
L<Plagger>, L<feed2imap(1)>, L<rss2email(1)>, L<rssdrop(1)>, L<toursst(1)>,
L<http://www.gwene.org>
=head1 HOME PAGE
L<http://user42.tuxfamily.org/rss2leafnode/index.html>
=head1 LICENSE
( run in 0.745 second using v1.01-cache-2.11-cpan-beeb90c9504 )