Show
Ignore:
Timestamp:
03/07/08 22:28:04 (9 months ago)
Author:
yusukebe
Message:

apply to SP1 see http://www.smallstyle.com/20080306.html

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/plagger/lib/Plagger/Plugin/Filter/FetchNicoVideo.pm

    r6752 r7636  
    7474        Encode::from_to( $filename, "utf-8", $self->conf->{filename_encode} ); 
    7575    } 
    76     my $path = File::Spec->catfile( $self->conf->{dir}, $filename . ".flv" ); 
     76 
     77    $enclosure->url =~ m!^http://[^/]+(?:smilevideo|nicovideo)\.jp/smile\?(\w)=(?:[^.]+)\.\d+(?:low)?!; 
     78    my %video_type_of = ( 
     79                         v => 'flv', 
     80                         m => 'mp4', 
     81                         s => 'swf', 
     82                      ); 
     83    my $ext = exists( $video_type_of{$1} ) ? $video_type_of{$1} : "flv"; 
     84     
     85    my $path = File::Spec->catfile( $self->conf->{dir}, $filename . ".$ext" ); 
    7786 
    7887    unless ( -e $path ) { 
     
    113122        $enclosure->length( $res->header('Content-Length') ); 
    114123    } 
     124    $enclosure->type( Plagger::Util::mime_type_of($path) ); 
    115125    $entry->add_enclosure($enclosure); 
    116126}