Changeset 246
- Timestamp:
- 08/28/06 22:12:18 (2 years ago)
- Files:
-
- plagger/trunk/lib/Plagger/Plugin/Filter/Audio.pm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plagger/trunk/lib/Plagger/Plugin/Filter/Audio.pm
r245 r246 20 20 my($self, $context, $args) = @_; 21 21 22 my $from = $self->conf->{from}; 23 my $to = $self->conf->{to}; 24 22 25 my $e = $args->{entry}; 23 26 24 27 { 25 28 no strict 'refs'; 26 *convert = *{ $ self->conf->{from} . '2' . $self->conf->{to}};29 *convert = *{ $from . '2' . $to }; 27 30 } 28 31 … … 33 36 } 34 37 35 my $basename = basename($local_path, $ self->conf->{from});36 my $ converted_file = File::Spec->catfile($self->conf->{dir}, $basename . $self->conf->{to});37 my $ status = convert($local_path) unless -e $converted_file;38 my $basename = basename($local_path, $from); 39 my $local_dir = dirname($local_path); 40 my $converted_file = File::Spec->catfile($self->conf->{dir}, $basename . $to); 38 41 39 if($status){ 40 move($local_path, $converted_file); 41 my $st = stat($converted_file); 42 $e->enclosure->length($st->size); 43 $e->enclosure->local_path($converted_file); 44 $e->enclosure->filename($basename . $self->conf->{to}); 45 $e->enclosure->type( Plagger::Util::mime_type_of($self->conf->{to}) ); 42 unless ( -e $converted_file ){ 43 my $status = convert($local_path); 44 unless ( $status ) { 45 $context->log(error => "Could not convert $local_path" ); 46 return; 47 } 46 48 } 47 else { 48 $context->log(error => "Could not convert $local_path" ); 49 } 49 50 move( File::Spec->catfile( $local_dir, $basename . $to ), $converted_file ); 51 my $st = stat($converted_file); 52 $e->enclosure->length($st->size); 53 $e->enclosure->local_path($converted_file); 54 $e->enclosure->filename($basename . $to); 55 $e->enclosure->type( Plagger::Util::mime_type_of($to) ); 50 56 } 51 57
