Changeset 1400
- Timestamp:
- 08/19/06 17:25:23
- Files:
-
- trunk/plagger/lib/Plagger/Plugin/Filter/FetchEnclosure.pm (modified) (3 diffs)
- trunk/plagger/lib/Plagger/Plugin/Notify/Audio.pm (modified) (2 diffs)
- trunk/plagger/lib/Plagger/Plugin/Notify/Audio/MSWin32.pm (modified) (1 diff)
- trunk/plagger/lib/Plagger/Plugin/Notify/Audio/iTunesWin32.pm (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/Filter/FetchEnclosure.pm
r841 r1400 3 3 use base qw( Plagger::Plugin ); 4 4 5 use Cwd; 5 6 use File::Spec; 6 7 use File::Path; … … 19 20 20 21 defined $self->conf->{dir} or Plagger->context->error("config 'dir' is not set."); 22 # XXX make it Plagger::Util function 23 if ($self->conf->{dir} =~ /^[a-zA-Z]/ && $self->conf->{dir} !~ /:/) { 24 $self->conf->{dir} = File::Spec->catfile( Cwd::cwd, $self->conf->{dir} ); 25 } 26 21 27 unless (-e $self->conf->{dir} && -d _) { 22 28 Plagger->context->log(warn => $self->conf->{dir} . " does not exist. Creating"); … … 36 42 } 37 43 38 my $path = File::Spec->catfile($feed_dir, $enclosure->filename); 44 my $filename = $enclosure->filename; 45 Encode::_utf8_off($filename); 46 my $path = File::Spec->catfile($feed_dir, $filename); 39 47 $context->log(info => "fetch " . $enclosure->url . " to " . $path); 40 48 trunk/plagger/lib/Plagger/Plugin/Notify/Audio.pm
r1399 r1400 2 2 use strict; 3 3 use base qw( Plagger::Plugin ); 4 5 use MP3::Info; 4 6 5 7 sub init { … … 45 47 } 46 48 47 for my $enclosures (@{$self->{enclosures}}) { 48 $self->log(info => "Play " . $enclosure->local_path); 49 $self->play($enclosure->local_path); 49 for my $enclosure (@{$self->{enclosures}}) { 50 # XXX this should be a separate plugin to handle MP4/WAV/ogg as well! 51 my $info = eval { MP3::Info->new($enclosure->local_path) }; 52 my $length = $info ? $info->secs : undef; 53 $self->log(info => "Play " . $enclosure->local_path . ($length ? " for $length seconds" : "")); 54 $self->play($enclosure->local_path, $length); 50 55 } 51 56 } trunk/plagger/lib/Plagger/Plugin/Notify/Audio/MSWin32.pm
r1397 r1400 6 6 7 7 sub play { 8 my($self, $filename ) = @_;8 my($self, $filename, $length) = @_; 9 9 $filename ||= "SystemExclamation"; 10 $length ||= 3; 10 11 11 Win32::Sound::Play($filename); 12 Win32::Sound::Play($filename, SND_ASYNC); 13 sleep $length; 12 14 } 13 15 trunk/plagger/lib/Plagger/Plugin/Notify/Audio/iTunesWin32.pm
r1399 r1400 6 6 7 7 sub play { 8 my($self, $filename ) = @_;8 my($self, $filename, $length) = @_; 9 9 $filename or return $self->log(error => "filename is not set"); 10 10 11 11 my $itunes = Win32::OLE->new("iTunes.Application"); 12 12 $itunes->PlayFile($filename); 13 sleep $length; 13 14 } 14 15
