Changeset 3

Show
Ignore:
Timestamp:
10/01/06 04:28:37
Author:
yohei
Message:

Add a dir_only option and fix some codes

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plagger/trunk/my-plugins/CustomFeed-FileList/FileList.pm

    r2 r3  
    33use base qw( Plagger::Plugin ); 
    44 
    5 use Encode; 
    65use Plagger::UserAgent; 
    7 use Plagger::Util qw( decode_content extract_title ); 
     6use Plagger::Util qw( decode_content ); 
    87use Plagger::Date; 
     8use Digest::MD5 qw(md5_hex); 
    99 
    1010 
     
    4444 
    4545 
     46    # input resutl of 'ls -laRT' 
    4647    my @files = split /\n/, $content; 
    4748       @files = map  {s!/$!!; $_} 
     
    5051    for my $file (@files) { 
    5152        my @infos = split /\s+/, $file;  
     53        next if ($self->conf->{dir_only} && $infos[0] =~ m!^d!); 
     54 
    5255        my $title  = $infos[9]; 
    5356        my $author = $infos[2]; 
     
    5558 
    5659        my $entry = Plagger::Entry->new; 
    57         $entry->title($infos[9]); 
     60        $entry->title($title); 
    5861 
    59         $entry->author($infos[2]); 
     62        $entry->author($author); 
    6063        $entry->date(Plagger::Date->strptime('%m %d %T %Y', $date)); 
    61         $entry->id($file); 
     64        $entry->id(md5_hex($file)); 
    6265 
    6366        $feed->add_entry($entry);