Changeset 727

Show
Ignore:
Timestamp:
05/13/06 05:52:11
Author:
miyagawa
Message:
  • Added CustomFeed?::YouTube? from mizzy branch. Added caching, removed tag search and updated to enclosure API
  • $enclosure->filename now can be set in plugins to avoid /get_video issue with YouTube?
  • dependency for MIME::Types
  • FetchEnclosure?: reset $enclosure->length
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/plagger/Makefile.PL

    r692 r727  
    2323requires('HTML::ResolveLink'); 
    2424requires('Date::Parse'); 
     25requires('MIME::Types'); 
    2526 
    2627build_requires(Test::More => 0.42); 
  • trunk/plagger/lib/Plagger/Enclosure.pm

    r726 r727  
    3333sub filename { 
    3434    my $self = shift; 
    35     (split '/', $self->url->path)[-1]; 
     35    if (@_) { 
     36        $self->{filename} = shift; 
     37    } 
     38    $self->{filename} || (split '/', $self->url->path)[-1]; 
    3639} 
    3740 
  • trunk/plagger/lib/Plagger/Plugin/Filter/FetchEnclosure.pm

    r726 r727  
    3838        my $path = File::Spec->catfile($feed_dir, $enclosure->filename); 
    3939        $context->log(info => "fetch " . $enclosure->url . " to " . $path); 
    40         $ua->mirror($enclosure->url, $path); 
     40        my $res = $ua->mirror($enclosure->url, $path); 
    4141        $enclosure->local_path($path); # set to be used in later plugins 
     42 
     43        # Fix length if it's broken 
     44        if ($res->header('Content-Length')) { 
     45            $enclosure->length( $res->header('Content-Length') ); 
     46        } 
    4247    } 
    4348}