Show
Ignore:
Timestamp:
10/08/07 14:57:46 (14 months ago)
Author:
otsune
Message:

lang/perl/plagger/deps/Filter-FLVInfo.yaml: add deps
lang/perl/plagger/lib/Plagger/Plugin/Filter/FLVInfo.pm: add config and refactoring

Files:
1 modified

Legend:

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

    r416 r431  
    2222    my $enclosure = $entry->enclosure; 
    2323    if (!defined $enclosure) { 
    24         $context->log(error => q{Can't find an encosure.}); 
     24        $context->log(error => q{Can't find an enclosure.}); 
    2525        return; 
    2626    } 
     
    3333 
    3434    my $local_path = $enclosure->local_path; 
    35     if ($enclosure->local_path !~ m/\.flv$/xmsg) { 
     35    if ($local_path !~ m/\.flv$/xmsg) { 
    3636        $context->log(warn => qq{Can't get info from $local_path.}); 
    3737        return; 
     
    4242    $reader->parse($enclosure->local_path); 
    4343 
    44     my %info =  $reader->get_info; 
     44    my %info = $reader->get_info; 
     45    my %flvinfo; 
    4546 
    4647    my $height = $info{video_height} || $info{meta_height}; 
    4748    my $width  = $info{video_width}  || $info{meta_width}; 
    4849 
    49     my $aspect; 
    50     if ($width/$height > 1.5) { 
    51         $aspect = '16:9'; 
    52     } 
    53     else { 
    54         $aspect = '4:3'; 
    55     } 
    56  
    57     $entry->meta->{flvinfo} = { 
     50    %flvinfo = ( 
    5851        height => $height, 
    5952        width  => $width, 
    60         aspect => $aspect, 
    61     }; 
     53        aspect => ($width/$height > 1.5) ? '16:9' : '4:3' , 
     54    ); 
     55 
     56    my $metadata_keys = $self->conf->{metadata}; 
     57    $metadata_keys = [ $metadata_keys ] unless ref $metadata_keys; 
     58    map { $flvinfo{$_} = $info{$_} } @{$metadata_keys}; 
     59 
     60    $entry->meta->{flvinfo} = \%flvinfo; 
     61     
    6262} 
    6363 
     
    9191=head1 CONFIG 
    9292 
     93  - module: Filter::FLVInfo 
     94    config: 
     95      metadata: 
     96        - duration 
     97        - video_codec 
     98        - audio_rate 
     99 
    93100=head1 AUTHOR 
    94101 
    95 Yohei Fushii 
     102Yohei Fushii, Masafumi Otsune 
    96103 
    97104=head1 SEE ALSO