/usr/share/yarssr/Yarssr/FeedIcon.pm is in yarssr 0.2.2-9.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | package Yarssr::FeedIcon;
use Yarssr::Fetcher;
sub new
{
my $class = shift;
my $feed = shift;
my $icondir = $Yarssr::Config::icondir;
my $self = {
iconfile => $icondir.$feed->get_title.".ico",
url => $feed->get_url,
};
bless $self,$class;
# If we can't load an icon from a file, then try to download one
# and attempt to load from the file again
unless ($self->load_icon()) {
$self->update;
$self->load_icon;
}
return $self;
}
sub get_pixbuf {
my $self = shift;
return $self->{'pixbuf'};
}
sub update {
my $self = shift;
my ($content,$type) = Yarssr::Fetcher->fetch_icon($self->{'url'});
open(ICO,'>',$self->{'iconfile'})
or warn "Could not open icon file: $self->{'iconfile'}\n";
if ($type ne 'text/html' and $content)
{
print ICO $content;
close(ICO);
}
else {
print ICO "";
close(ICO);
}
}
sub load_icon {
my $self = shift;
if (! -e $self->{'iconfile'}) {
$self->{'pixbuf'} = 0;
return 0;
}
my $pixbuf = $self->{'pixbuf'};
eval {
$pixbuf = Gtk2::Gdk::Pixbuf->new_from_file($self->{'iconfile'});
$pixbuf = $pixbuf->scale_simple(16,16,'bilinear')
if ($pixbuf->get_height != 16);
};
$self->{'pixbuf'} = $pixbuf;
return 1;
}
1;
|