Changeset 1622

Show
Ignore:
Timestamp:
08/29/06 07:10:58
Author:
miyagawa
Message:

merge from trunk

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/hackathon-summary/plagger/Changes

    r1370 r1622  
    11The latest, HTML version of this document is always available at http://plagger.org/trac.cgi/wiki/PlaggerChangeLog 
     2 
     3== 0.7.9 (2006/08/24) == 
     4 
     5=== Core === 
     6 
     7 * Fixed BaseDirURI logic to allow empty dirname on Mac OSX (Yappo) 
     8 * Added tests to lots of plugins thanks to Testathoners 
     9 * Added Plagger::Walker util class to serialize feed data 
     10 * Merged from hackathon-mt branch. Added Plagger->set_context method 
     11 * Split bootstrap into new() and run() to be used in persisten programs 
     12 * Added $context->search() stub to get Plagger::Feed object from Search::* backends 
     13 * Added bin/plagger-search prototype CLI 
     14 * Added bin/plagger-atom-stream-consumer, very experimental AtomStream consumer 
     15 * Updated Plagger::Template->new() parameter 
     16 * assets_path: can now be localized per plugins using config:assets_path 
     17 * lots of fixes to tests so it can work on Windows 
     18 * decode config.yaml as UTF-8 automatically before run, unless you specify global:no_decode_utf8=1 
     19 * chimps-client: create lock dir to avoid double excecution 
     20 * Split feed parsing logic from Aggregator::Simple to Plagger::FeedParser so plugins can use.  
     21 * Added $ua->fetch_parse($feed) and $ua->find_parse($url) 
     22 * Fixed misusage of Term::Encoding (Yappo) 
     23 * Support entry level image in RSS 0.91 and 2.0 
     24 
     25 
     26=== New Plugins === 
     27 
     28 * Publish::JSON: Serialize feed to JSON (miyagawa) 
     29 * Publish::Serializer: Dump feed to various format using Data::Serializer (naoya, miyagawa) 
     30 * Notify::Audio: Play sound files when feed comes. Support playing enclosure files as well (miyagawa, youpy) 
     31 
     32=== Plugins Updates === 
     33 
     34 * Publish::Gmail: support APOP authentication in POP before SMTP 
     35 * Filter::Delicious: use Plagger::UA for caching. 
     36 * CustomFeed::Yahoo360JP: removed from the distro since no one is using it and it's broken 
     37 * Widget::Simple: Added lots of widgets (hsbt, jiro, drawnboy) 
     38 * Filter::EntryFullText: Fixed XHTML numeric entities issue when using XPath (spotted by otsune) 
     39 * Filter::2chRSSContent: Strip AD entry 
     40 * CustomFeed::YouTube: fix regexp to get page content (mizzy) 
     41 * Subscription::OPML: Fixed bug where containers are not correctly loaded because of array reference 
     42 * Subscriptoin::OPML: Ditch XML::OPML and rewrite OPML parser using XML::LibXML::SAX 
     43 * Filter::EntryFullText: extract_capture defaults to 'body' (suggested by otsune) 
     44 * Search::Rast: implemented searcher.search API (Yappo) 
     45 * Filter::TruePermalink: Fixed ref=rss YAML. Removed redirectors.yaml and instead introduced 'follow_redirect' config (default: 1) 
     46 * Notify::IRC: use color code scheme to colorize feed title and author (#movabletype) 
    247 
    348== 0.7.8 (2006/08/18) == 
  • branches/hackathon-summary/plagger/MANIFEST

    r1379 r1622  
    4949assets/plugins/Filter-EntryFullText/japan_zdnet_com.yaml 
    5050assets/plugins/Filter-EntryFullText/juno.yaml 
     51assets/plugins/Filter-EntryFullText/kojii_net.yaml 
    5152assets/plugins/Filter-EntryFullText/kyodo.yaml 
    5253assets/plugins/Filter-EntryFullText/kyoko_shimbun_news.yaml 
     
    118119assets/plugins/Filter-FindEnclosures/yourfilehost.pl 
    119120assets/plugins/Filter-FindEnclosures/youtube.pl 
    120 assets/plugins/Filter-StripRSSAd/feedburner 
    121 assets/plugins/Filter-StripRSSAd/google_adsense 
    122 assets/plugins/Filter-StripRSSAd/google_adsense2 
     121assets/plugins/Filter-StripRSSAd/feedburner.pat 
     122assets/plugins/Filter-StripRSSAd/google_adsense.pat 
     123assets/plugins/Filter-StripRSSAd/google_adsense2.pat 
    123124assets/plugins/Filter-StripRSSAd/namaan_ad.yaml 
    124 assets/plugins/Filter-StripRSSAd/pheedo 
    125 assets/plugins/Filter-StripRSSAd/pheedo_jp 
     125assets/plugins/Filter-StripRSSAd/pheedo.pat 
     126assets/plugins/Filter-StripRSSAd/pheedo_jp.pat 
    126127assets/plugins/Filter-StripRSSAd/pheedo_jp_ad_entry.yaml 
    127 assets/plugins/Filter-StripRSSAd/plaza_rakuten 
    128 assets/plugins/Filter-StripRSSAd/rssad_jp 
    129 assets/plugins/Filter-StripRSSAd/seesaa 
    130 assets/plugins/Filter-StripRSSAd/valueclick 
     128assets/plugins/Filter-StripRSSAd/plaza_rakuten.pat 
     129assets/plugins/Filter-StripRSSAd/rssad_jp.pat 
     130assets/plugins/Filter-StripRSSAd/seesaa.pat 
     131assets/plugins/Filter-StripRSSAd/valueclick.pat 
    131132assets/plugins/Filter-TruePermalink/2chrss.yaml 
    132133assets/plugins/Filter-TruePermalink/blogpeople.yaml 
     
    140141assets/plugins/Filter-TruePermalink/rd_yahoo.yaml 
    141142assets/plugins/Filter-TruePermalink/reddit.yaml 
    142 assets/plugins/Filter-TruePermalink/redirectors.yaml 
    143143assets/plugins/Filter-TruePermalink/refrss.yaml 
     144assets/plugins/Filter-TruePermalink/rssquery.yaml 
    144145assets/plugins/Filter-TruePermalink/tech_souken.yaml 
    145146assets/plugins/Filter-TruePermalink/tiyu_to.yaml 
     
    176177assets/plugins/Subscription-Planet/default.yaml 
    177178assets/plugins/Subscription-Planet/ja.yaml 
     179assets/plugins/Widget-Simple/1470.yaml 
    178180assets/plugins/Widget-Simple/bloglines.yaml 
     181assets/plugins/Widget-Simple/blogmap.yaml 
    179182assets/plugins/Widget-Simple/bulkfeeds.yaml 
    180183assets/plugins/Widget-Simple/delicious.yaml 
    181184assets/plugins/Widget-Simple/delicious_bookmark_users.yaml 
     185assets/plugins/Widget-Simple/digg.yaml 
     186assets/plugins/Widget-Simple/google_pagerank.yaml 
    182187assets/plugins/Widget-Simple/hatena_bookmark.yaml 
    183188assets/plugins/Widget-Simple/hatena_bookmark_users.yaml 
     
    185190assets/plugins/Widget-Simple/mm.yaml 
    186191assets/plugins/Widget-Simple/reddit.yaml 
     192assets/plugins/Widget-Simple/technorati.yaml 
    187193AUTHORS 
     194bin/plagger-atom-stream-consumer 
    188195bin/plagger-ircbot 
     196bin/plagger-search 
    189197bin/spotlight_comment.scpt 
    190198Changes 
     
    194202deps/CustomFeed-Mixi.yaml 
    195203deps/CustomFeed-SVNLog.yaml 
     204deps/Filter-2chNewsokuTitle.yaml 
     205deps/Filter-2chRSSContent.yaml 
     206deps/Filter-AtomLinkRelated.yaml 
    196207deps/Filter-Babelfish.yaml 
     208deps/Filter-BlogPet.yaml 
    197209deps/Filter-Delicious.yaml 
     210deps/Filter-DeliciousFeedTags.yaml 
    198211deps/Filter-Emoticon.yaml 
    199212deps/Filter-EntryFullText.yaml 
    200213deps/Filter-ExtractAuthorName.yaml 
     214deps/Filter-FeedFlareStripper.yaml 
    201215deps/Filter-GuessLanguage.yaml 
     216deps/Filter-HatenaBookmarkTag.yaml 
    202217deps/Filter-HatenaBookmarkUsersCount.yaml 
    203218deps/Filter-HatenaDiaryKeywordLink.yaml 
    204219deps/Filter-HatenaFormat.yaml 
     220deps/Filter-HatenaKeywordTag.yaml 
    205221deps/Filter-HTMLScrubber.yaml 
    206222deps/Filter-ImageInfo.yaml 
     223deps/Filter-Markdown.yaml 
    207224deps/Filter-Pipe.yaml 
     225deps/Filter-POPFile.yaml 
    208226deps/Filter-Profanity.yaml 
    209227deps/Filter-ResolveRelativeLink.yaml 
    210228deps/Filter-Romanize.yaml 
    211229deps/Filter-RSSLiberalDateTime.yaml 
     230deps/Filter-SpamAssassin.yaml 
     231deps/Filter-StripRSSAd.yaml 
     232deps/Filter-tDiaryComment.yaml 
    212233deps/Filter-Thumbnail.yaml 
    213234deps/Filter-TTP.yaml 
     235deps/Filter-URLBL.yaml 
     236deps/Notify-Audio-iTunesWin32.yaml 
     237deps/Notify-Audio-MSWin32.yaml 
     238deps/Notify-Audio.yaml 
    214239deps/Notify-Balloon.yaml 
    215240deps/Notify-Beep.yaml 
     
    220245deps/Notify-UpdatePing.yaml 
    221246deps/Publish-2chdat.yaml 
     247deps/Publish-CHTML.yaml 
    222248deps/Publish-CSV.yaml 
    223249deps/Publish-Delicious.yaml 
     
    227253deps/Publish-IMAP.yaml 
    228254deps/Publish-JavaScript.yaml 
     255deps/Publish-JSON.yaml 
    229256deps/Publish-Maildir.yaml 
    230257deps/Publish-MT.yaml 
     
    233260deps/Publish-Planet.yaml 
    234261deps/Publish-PowerPoint.yaml 
     262deps/Publish-Serializer.yaml 
    235263deps/Publish-Speech-MacOSX.yaml 
    236264deps/Publish-Speech-Win32.yaml 
     
    243271deps/Subscription-Bloglines.yaml 
    244272deps/Subscription-Bookmarks-InternetExplorer.yaml 
     273deps/Subscription-Bookmarks-Mozilla.yaml 
    245274deps/Subscription-Bookmarks-Safari.yaml 
    246275deps/Subscription-DBI.yaml 
     
    248277deps/Subscription-HatenaRSS.yaml 
    249278deps/Subscription-LivedoorReader.yaml 
     279deps/Subscription-Odeo.yaml 
    250280deps/Subscription-OPML.yaml 
     281deps/Subscription-PingServer.yaml 
    251282deps/Subscription-PlanetINI.yaml 
     283deps/Subscription-XOXO.yaml 
     284deps/Subscription-XPath.yaml 
    252285deps/Widget-Simple.yaml 
    253286examples/atode.yaml 
     
    259292examples/planet.yaml 
    260293examples/podcast.yaml 
     294examples/rss2email.yaml 
    261295examples/search.yaml 
     296examples/weather-notify.yaml 
    262297examples/xoxo-planet.yaml 
    263298examples/xoxo2opml.yaml 
     
    300335lib/Plagger/Entry.pm 
    301336lib/Plagger/Feed.pm 
     337lib/Plagger/FeedParser.pm 
    302338lib/Plagger/Mechanize.pm 
    303339lib/Plagger/Operator.pm 
     
    382418lib/Plagger/Plugin/Filter/TTP.pm 
    383419lib/Plagger/Plugin/Filter/URLBL.pm 
     420lib/Plagger/Plugin/Notify/Audio.pm 
     421lib/Plagger/Plugin/Notify/Audio/iTunesMac.pm 
     422lib/Plagger/Plugin/Notify/Audio/iTunesWin32.pm 
     423lib/Plagger/Plugin/Notify/Audio/MSWin32.pm 
    384424lib/Plagger/Plugin/Notify/Balloon.pm 
    385425lib/Plagger/Plugin/Notify/Beep.pm 
     
    409449lib/Plagger/Plugin/Publish/IMAP.pm 
    410450lib/Plagger/Plugin/Publish/JavaScript.pm 
     451lib/Plagger/Plugin/Publish/JSON.pm 
    411452lib/Plagger/Plugin/Publish/LivedoorClip.pm 
    412453lib/Plagger/Plugin/Publish/Maildir.pm 
     
    422463lib/Plagger/Plugin/Publish/PowerPoint.pm 
    423464lib/Plagger/Plugin/Publish/PSP.pm 
     465lib/Plagger/Plugin/Publish/Serializer.pm 
    424466lib/Plagger/Plugin/Publish/Speech.pm 
    425467lib/Plagger/Plugin/Publish/Speech/MacOSX.pm 
     
    485527lib/Plagger/UserAgent.pm 
    486528lib/Plagger/Util.pm 
     529lib/Plagger/Walker.pm 
    487530Makefile.PL 
    488531MANIFEST                        This list of files 
     
    490533plagger 
    491534t/00_compile.t 
     535t/assets/plugins/Test-AssetsPath/assets_path.tt 
     536t/samples/assets_path.tt 
    492537t/samples/atom-category.xml 
     538t/samples/atom-related.xml 
    493539t/samples/atom10-example.xml 
    494540t/samples/babelfish.xml 
     541t/samples/config.ini 
    495542t/samples/delicious.xml 
     543t/samples/feed.xml 
     544t/samples/feeds.txt 
    496545t/samples/googlevideo.xml 
    497546t/samples/guess-language/english.xml 
     
    507556t/samples/included.yaml 
    508557t/samples/monkey.rss 
     558t/samples/mozilla-bookmarks.html 
    509559t/samples/nasty.xml 
    510560t/samples/non-http-link.xml 
     561t/samples/opml-nested.xml 
     562t/samples/opml.xml 
    511563t/samples/photocast.rss 
    512564t/samples/rss-20.xml 
    513565t/samples/rss-full.xml 
     566t/samples/rss2-image.xml 
    514567t/samples/rss2sample.xml 
     568t/samples/safari_bookmarks.plist 
     569t/samples/sample.foaf 
     570t/samples/spamassassin/ham_rule.txt 
     571t/samples/spamassassin/spam_rule.txt 
    515572t/samples/tags-in-title.xml 
     573t/samples/tags-to-title.xml 
     574t/samples/tdiary.rdf 
     575t/samples/top10news.xml 
    516576t/samples/vox.xml 
     577t/samples/xoxo.html 
    517578t/TestPlagger.pm 
    518579tools/check-dependencies.pl 
  • branches/hackathon-summary/plagger/Makefile.PL

    r1544 r1622  
    2929requires('XML::Feed', 0.12); 
    3030requires('XML::LibXML'); 
    31 requires('XML::Atom', 0.19); 
     31requires('XML::Atom', 0.23); 
    3232requires('XML::RSS::LibXML', 0.20); 
    3333requires('Encode', 2.10); 
     
    4343features( 
    4444    'Better Encoding detection' => [ 
    45         -default => 1
     45        -default => 0
    4646        recommends('Encode::Detect'), 
    4747    ], 
     
    5757    'Liberal XML parsing' => [ 
    5858        -default => 1, 
    59         recommends('XML::Liberal', 0.13), 
     59        recommends('XML::Liberal', 0.14), 
    6060        recommends('XML::RSS::Liberal'), 
    6161    ], 
     
    9696auto_include; 
    9797auto_install; 
     98 
    9899install_script('plagger'); 
    99100install_script('bin/plagger-ircbot'); 
  • branches/hackathon-summary/plagger/assets/plugins/Filter-EntryFullText/slashcode.pl

    r757 r1622  
    11sub handle { 
    22    my($self, $args) = @_; 
    3     $args->{entry}->permalink =~ m!article\.pl\?sid=\d\d/\d\d/\d\d/\d+!; 
     3    $args->{entry}->permalink =~ m!article\.pl\?sid=\d\d/\d\d/\d\d/\d+|/~\w+/journal/\d+$!; 
    44} 
    55 
  • branches/hackathon-summary/plagger/assets/plugins/Filter-EntryFullText/zakzak.yaml

    r519 r1622  
    11# used with http://www.zakzak.co.jp/ or http://bulknews.net/rss/rdf.cgi?ZakZak 
    22author: youpy 
    3 custom_feed_handle: http://www\.zakzak\.co\.jp/$ 
     3custom_feed_handle: http://www\.zakzak\.co\.jp/ 
    44custom_feed_follow_link: (?:top|spo|gei)/\d+.*?\.html 
    55handle: http://www\.zakzak\.co\.jp/(?:top|spo|gei)/\d+ 
  • branches/hackathon-summary/plagger/assets/plugins/Filter-StripRSSAd/pheedo_jp_ad_entry.yaml

    r758 r1622  
    1 condition: $args->{entry}->link =~ m!^http://www\.pheedo\.jp/click\.phdo\?z=\w+&a=\w+&unq=\w+
     1condition: $args->{entry}->link =~ m!^http://www\.pheedo\.jp/click\.phdo\?(?:a=[\w\/]+|z=\w+&a=\w+&unq=\w+)! && $args->{entry}->title =~ m!^AD:
    22strip: 1 
    33 
  • branches/hackathon-summary/plagger/assets/plugins/Filter-TruePermalink/refrss.yaml

    r690 r1622  
    11author: youpy 
    2 rewrite: s/[\?&](?:ref|from|FM)=(?:atom|rss)// 
     2rewrite: s/[\?&;](?:ref|from|FM)=(?:atom|rss|rssall)([&;].*)?$/$1/ 
     3 
  • branches/hackathon-summary/plagger/assets/plugins/Notify-IRC/irc_notify.tt

    r1232 r1622  
    1 [%- SET title = feed.title || '(no-title)' -%] 
    2 [% feed.title_text %]: [% entry.title_text %] - [% entry.link %][% IF entry.author %] by [% entry.author %][% END %] 
     1[% IF feed.title %][% feed.title_text %]: [% END %][% entry.title_text %][% IF entry.author %] (03[% entry.author %])[% END %] - 14[% entry.permalink %] 
  • branches/hackathon-summary/plagger/assets/plugins/Widget-Simple/google_pagerank.yaml

    r1380 r1622  
    22query: 
    33  q: $args->{feed}->link 
    4 content_dynamic: <img src="http://www.pagerankon.com/smerankcheck.php?site=[% feed.link %]&s=style7" border="0" alt="Google PageRank"
     4content_dynamic: <img src="http://www.pagerankon.com/smerankcheck.php?site=[% feed.link %]&s=style7" border="0" alt="Google PageRank" style="border:0;vertical-align:middle" /
  • branches/hackathon-summary/plagger/bin/plagger-search

    r1391 r1622  
    33use warnings; 
    44 
    5 use Encode
     5use Encode ()
    66use FindBin; 
    77use Getopt::Long; 
     
    1515 
    1616my $context = Plagger->new(config => $path); 
    17 my $query = Encode::decode_utf8($ARGV[0]); 
     17my $query = decode($ARGV[0]); 
    1818 
    1919my @feeds = $context->search($query); 
    2020 
    2121my $feed = $feeds[0]; 
    22 binmode STDOUT, ":utf8"; 
    23 print "Search for '$query': ", $feed->count, " entries found.\n\n"; 
     22binmode STDOUT, ":utf8" unless $context->conf->{log}->{encoding}; 
     23exit unless $feed; 
     24print "Search for '" . encode($query) . "': ", $feed->count , " entries found.\n\n"; 
    2425 
    2526for my $entry ($feed->entries) { 
    26     print $entry->title, $entry->author ? "(by " . $entry->author . ")" : '', "\n"; 
    27     print $entry->body; # summary 
     27    print encode($entry->title), $entry->author ? "(by " . encode($entry->author) . ")" : '', "\n"; 
     28    print encode($entry->body); # summary 
    2829    print $entry->permalink, "\n"; 
    2930} 
    3031 
     32sub decode { 
     33    my $str = shift; 
     34    if ($context->conf->{log}->{encoding}) { 
     35        $str = Encode::decode($context->conf->{log}->{encoding}, $str); 
     36    } else { 
     37        $str = Encode::decode_utf8($str); 
     38    } 
     39    return $str; 
     40} 
     41 
     42sub encode { 
     43    my $str = shift; 
     44    if ($context->conf->{log}->{encoding}) { 
     45        $str = Encode::decode_utf8($str) unless utf8::is_utf8($str); 
     46        $str = Encode::encode($context->conf->{log}->{encoding}, $str); 
     47    } 
     48    return $str; 
     49} 
  • branches/hackathon-summary/plagger/lib/Plagger.pm

    r1618 r1622  
    11package Plagger; 
    22use strict; 
    3 our $VERSION = '0.7.8'; 
     3our $VERSION = '0.7.9'; 
    44 
    55use 5.8.1; 
     
    9191    } 
    9292 
    93     open my $fh, $self->{config_path} or $self->error("$self->{config_path}: $!"); 
     93    open my $fh, '<', $self->{config_path} or $self->error("$self->{config_path}: $!"); 
    9494    my $data = join '', <$fh>; 
    9595    close $fh; 
     
    187187    my($self, $file) = @_; 
    188188 
    189     open my $fh, $file or die "$file: $!"; 
     189    open my $fh, '<', $file or die "$file: $!"; 
    190190    while (<$fh>) { 
    191191        /^package (Plagger::Plugin::.*?);/ and return $1; 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin.pm

    r1412 r1622  
    1313use File::Find::Rule (); 
    1414use File::Spec; 
     15use Scalar::Util qw(blessed); 
    1516 
    1617sub new { 
     
    149150    my($self, $rule, $callback) = @_; 
    150151 
    151     my $context = Plagger->context; 
    152  
    153     my $dir = $self->assets_dir; 
     152    unless (blessed($rule) && $rule->isa('File::Find::Rule')) { 
     153        $rule = File::Find::Rule->name($rule); 
     154    } 
    154155 
    155156    # $rule isa File::Find::Rule 
    156     for my $file ($rule->in($dir)) { 
    157         $callback->($file); 
     157    for my $file ($rule->in($self->assets_dir)) { 
     158        my $base = File::Basename::basename($file); 
     159        $callback->($file, $base); 
    158160    } 
    159161} 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Aggregator/Simple.pm

    r1611 r1622  
    9999 
    100100    if ($remote->format =~ /^RSS/) { 
    101         $feed->image( $remote->{rss}->image
     101        $feed->image( \%{$remote->{rss}->image}
    102102            if $remote->{rss}->image; 
    103103    } elsif ($remote->format eq 'Atom') { 
     
    170170        } 
    171171 
     172        # entry image support 
     173        if ($remote->format =~ /^RSS / and my $img = $e->{entry}->{image}) { 
     174            $entry->icon(\%$img); 
     175        } 
     176 
    172177        # TODO: move MediaRSS, Hatena, iTunes and those specific parser to be subclassed 
    173178        $self->handle_media_rss($entry, $e); 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Filter/EntryFullText.pm

    r1573 r1622  
    3737    my $context = Plagger->context; 
    3838 
    39     my $dir = $self->assets_dir; 
    40     my $dh = DirHandle->new($dir) or $context->error("$dir: $!"); 
    41     for my $file (grep -f $_->[0] && $_->[0] =~ /\.(?:pl|yaml)$/, 
    42                   map [ File::Spec->catfile($dir, $_), $_ ], sort $dh->read) { 
    43         $self->load_plugin(@$file); 
    44     } 
    45 
    46  
    47 sub load_plugin { 
    48     my($self, $file, $base) = @_; 
    49  
    50     Plagger->context->log(debug => "loading $file"); 
    51  
    52     my $load_method = $file =~ /\.pl$/ ? 'load_plugin_perl' : 'load_plugin_yaml'; 
    53     push @{ $self->{plugins} }, $self->$load_method($file, $base); 
     39    $self->load_assets('*.yaml', sub { $self->load_plugin_yaml(@_) }); 
     40    $self->load_assets('*.pl',   sub { $self->load_plugin_perl(@_) }); 
    5441} 
    5542 
     
    5744    my($self, $file, $base) = @_; 
    5845 
    59     open my $fh, $file or Plagger->context->error("$file: $!"); 
     46    Plagger->context->log(debug => "Load plugin $file"); 
     47 
     48    open my $fh, '<', $file or Plagger->context->error("$file: $!"); 
    6049    (my $pkg = $base) =~ s/\.pl$//; 
    6150    my $plugin_class = "Plagger::Plugin::Filter::EntryFullText::Site::$pkg"; 
     
    8069    Plagger->context->error($@) if $@; 
    8170 
    82     return $plugin_class->new; 
     71    push @{ $self->{plugins} }, $plugin_class->new; 
    8372} 
    8473 
    8574sub load_plugin_yaml { 
    8675    my($self, $file, $base) = @_; 
     76 
     77    Plagger->context->log(debug => "Load YAML $file"); 
    8778    my @data = YAML::LoadFile($file); 
    8879 
    89     return map { Plagger::Plugin::Filter::EntryFullText::YAML->new($_, $base) } 
    90         @data; 
     80    push @{ $self->{plugins} }, 
     81        map { Plagger::Plugin::Filter::EntryFullText::YAML->new($_, $base) } @data; 
    9182} 
    9283 
     
    253244        if (my @match = $args->{content} =~ /$self->{extract}/s) { 
    254245            my @capture = split /\s+/, $self->{extract_capture}; 
     246            @capture = ('body') unless @capture; 
    255247            @{$data}{@capture} = @match; 
    256248        } 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Filter/FindEnclosures.pm

    r1551 r1622  
    5353    my($self, $file, $base) = @_; 
    5454 
    55     open my $fh, $file or Plagger->context->error("$file: $!"); 
     55    open my $fh, '<', $file or Plagger->context->error("$file: $!"); 
    5656    (my $pkg = $base) =~ s/\.pl$//; 
    5757    my $plugin_class = "Plagger::Plugin::Filter::FindEnclosures::Site::$pkg"; 
     
    184184 
    185185    my $mime = $type ? MIME::Type->new(type => $type) : Plagger::Util::mime_type_of( URI->new($url) ); 
    186     $mime && $mime->mediaType =~ m!^(?:audio|video|image)$!
     186    Plagger::Util::mime_is_enclosure($mime)
    187187} 
    188188 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Filter/HEADEnclosureMetadata.pm

    r1505 r1622  
    7171    my($res, $header) = @_; 
    7272 
    73     my $value = $res->header($header) or return undef; 
     73    my $value = $res->header($header) or return undef; ## no critic 
    7474    $value =~ s/;.*?$//; 
    7575    $value; 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Filter/Rule.pm

    r444 r1622  
    2828 
    2929    if ($args->{feed}->count == 0) { 
    30         $context->log(debug => "Deleting " . $args->{feed}->url . " since it has 0 entries"); 
     30        $context->log(debug => "Deleting " . $args->{feed}->title . " since it has 0 entries"); 
    3131        $context->update->delete_feed($args->{feed}) 
    3232    } 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Filter/SpamAssassin.pm

    r1432 r1622  
    3232 
    3333    # create a pseudo mail header to skip some of the sa's default tests 
    34     my $status = $sa->check_message_text( 
    35         MIME::Lite->new( 
    36             From    => 'plagger@localhost', 
    37             To      => 'plagger@localhost', 
    38             Subject => encode('MIME-Header', $entry->title_text), 
    39             Data    => $entry->body_text, 
    40         )->as_string 
    41     ); 
     34 
     35    my $mail  = MIME::Lite->new( 
     36        From       => 'plagger@localhost', 
     37        To         => 'plagger@localhost', 
     38        Subject    => encode('MIME-Header', $entry->title_text), 
     39        'X-Mailer' => 'plagger', 
     40        Data       => $entry->body_text, 
     41    )->as_string; 
     42 
     43    my $status = $sa->check_message_text( $mail ); 
    4244 
    4345    if ($status->is_spam) { 
     
    6567      new: 
    6668        local_tests_only: 1 
    67         config_text: 
    68           - score NO_RELAYS       0.0 
    69           - score NO_RECEIVED     0.0 
     69        site_rules_filename: some_rule.cf 
    7070 
    7171=head1 CONFIG 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Filter/StripRSSAd.pm

    r1551 r1622  
    99    $self->SUPER::init(@_); 
    1010    Plagger->context->autoload_plugin({ module => 'Filter::BloglinesContentNormalize' }); 
    11     $self->load_patterns(); 
    12 } 
    1311 
    14 sub load_patterns { 
    15     my $self = shift; 
    16  
    17     my $dir = $self->assets_dir; 
    18     my $dh = DirHandle->new($dir) or Plagger->context->error("$dir: $!"); 
    19     for my $file (grep -f $_->[0] && $_->[1] =~ /^[\w\-\.]+$/, 
    20                   map [ File::Spec->catfile($dir, $_), $_ ], sort $dh->read) { 
    21         $self->load_pattern(@$file); 
    22     } 
    23 
    24  
    25 sub load_pattern { 
    26     my($self, $file, $base) = @_; 
    27  
    28     Plagger->context->log(debug => "loading $file"); 
    29  
    30     if ($file =~ /\.yaml$/) { 
    31         $self->load_yaml($file, $base); 
    32     } else { 
    33         $self->load_regexp($file, $base); 
    34     } 
     12    $self->load_assets('*.yaml', sub { $self->load_yaml(@_) }); 
     13    $self->load_assets('*.pat',  sub { $self->load_regexp(@_)}); 
    3514} 
    3615 
    3716sub load_regexp { 
    3817    my($self, $file, $base) = @_; 
     18    Plagger->context->log(debug => "Load regexp $file"); 
    3919 
    40     open my $fh, $file or Plagger->context->error("$file: $!"); 
     20    open my $fh, '<', $file or Plagger->context->error("$file: $!"); 
    4121    my $re = join '', <$fh>; 
    4222    chomp($re); 
     
    4727sub load_yaml { 
    4828    my($self, $file, $base) = @_; 
     29    Plagger->context->log(debug => "Load YAML $file"); 
    4930 
    5031    my $pattern = eval { YAML::LoadFile($file) } 
  • branches/hackathon-summary/plagger/lib/Plagger/Plugin/Filter/TruePermalink.pm