Changeset 887 for lang/perl/plagger

Show
Ignore:
Timestamp:
10/30/07 15:01:02 (13 months ago)
Author:
mizzy
Message:

lang/perl/plagger/lib/Plagger/Plugin/Filter/FFmpeg.pm: fix encoding.Thanks to lang/perl/plagger/lib/Plagger/Plugin/Filter.

Files:
1 modified

Legend:

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

    r272 r887  
    2626        if $self->conf->{ext} and $self->conf->{filename}; 
    2727 
    28     my $encoding = $self->conf->{encoding} || 'cp932'; 
    29  
    3028    my $enclosures = $entry->enclosures; 
    3129    $context->log( warn => 'You shuld not use filename option because the entry has several enclosures.' ) 
     
    4947 
    5048        my $ff = FFmpeg::Command->new($self->conf->{command}); 
    51         $ff->input_options({ file => encode($encoding, $enclosure->local_path) }); 
     49        $ff->input_options({ file =>  $self->convert($enclosure->local_path) }); 
    5250 
    5351        my $output_file = File::Spec->catfile($self->conf->{dir}, "$file"); 
    5452        my $output_options = { 
    55             file    => encode($encoding, $output_file), 
     53            file    => $self->convert($output_file), 
    5654            device  => $self->conf->{device} || 'ipod', 
    57             title   => encode($encoding, $entry->title), 
    58             author  => encode($encoding, $entry->author), 
    59             comment => encode($encoding, $entry->summary), 
     55            title   => $self->convert($entry->title), 
     56            author  => $self->convert($entry->author), 
     57            comment => $self->convert($entry->summary), 
    6058            %{ $self->conf->{options} || {} }, 
    6159        }; 
     
    9088        $enclosure->type( Plagger::Util::mime_type_of($file) ); 
    9189    } 
     90} 
     91 
     92 
     93sub convert { 
     94  my ($self, $str) = @_; 
     95  utf8::decode($str) unless utf8::is_utf8($str); 
     96  return encode($self->conf->{encoding} || 'cp932', $str); 
    9297} 
    9398