|
Revision 683
(checked in by miyagawa, 2 years ago)
|
- Plagger::Util::decode_content now takes $content or $res
- Try xml encoding header first, before HTML meta tag to guess charsets
- Subscription::XOXO to handle multibyte title okay
- Unhandled feed is removed from Subscription
- use Plagger::UserAgent? in Util.pm
- Planer: Unuse Scrubber for now
- Aggregator::Xango to handle auto-discovered feed mapping as well
|
- Property svn:keywords set to
Id Revision
|
| Line | |
|---|
| 1 |
package Plagger::Subscription; |
|---|
| 2 |
use strict; |
|---|
| 3 |
use base qw( Plagger::Update ); |
|---|
| 4 |
|
|---|
| 5 |
sub new { |
|---|
| 6 |
my $class = shift; |
|---|
| 7 |
bless { feeds => [], by_tags => {}, by_types => {} }, $class; |
|---|
| 8 |
} |
|---|
| 9 |
|
|---|
| 10 |
sub add { |
|---|
| 11 |
my($self, $feed) = @_; |
|---|
| 12 |
push @{ $self->{feeds} }, $feed; |
|---|
| 13 |
for my $tag ( @{$feed->tags} ) { |
|---|
| 14 |
push @{ $self->{by_tags}->{$tag} }, $feed; |
|---|
| 15 |
} |
|---|
| 16 |
push @{ $self->{by_types}->{$feed->type} }, $feed; |
|---|
| 17 |
} |
|---|
| 18 |
|
|---|
| 19 |
sub delete_feed { |
|---|
| 20 |
my($self, $feed) = @_; |
|---|
| 21 |
my @feeds = grep { $_ ne $feed } $self->feeds; |
|---|
| 22 |
$self->{feeds} = \@feeds; |
|---|
| 23 |
} |
|---|
| 24 |
|
|---|
| 25 |
sub types { |
|---|
| 26 |
my $self = shift; |
|---|
| 27 |
keys %{ $self->{by_types} }; |
|---|
| 28 |
} |
|---|
| 29 |
|
|---|
| 30 |
sub feeds_by_type { |
|---|
| 31 |
my($self, $type) = @_; |
|---|
| 32 |
@{ $self->{by_types}->{$type} || [] }; |
|---|
| 33 |
} |
|---|
| 34 |
|
|---|
| 35 |
1; |
|---|