Changeset 1399
- Timestamp:
- 08/19/06 17:04:09
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/plagger/lib/Plagger/Plugin/Notify/Audio.pm
r1397 r1399 20 20 $context->register_hook( 21 21 $self, 22 'publish. feed' => \&update,22 'publish.entry.fixup' => \&update, 23 23 'publish.finalize' => \&finalize, 24 24 ); 25 $self->{enclosures} = [ ]; 25 26 $self->{count} = 0; 26 27 } … … 28 29 sub update { 29 30 my($self, $context, $args) = @_; 30 $self->{count}++ if $args->{feed}->count; 31 32 if ($self->conf->{play_enclosures}) { 33 push @{$self->{enclosures}}, grep $_->local_path, $args->{entry}->enclosures; 34 } else { 35 $self->{count}++; 36 } 31 37 } 32 38 33 39 sub finalize { 34 40 my($self, $context, $args) = @_; 35 $self->play($self->conf->{filename}) if $self->{count}; 41 42 if ($self->{count}) { 43 $self->log(info => "Play $self->conf->{filename}"); 44 return $self->play($self->conf->{filename}); 45 } 46 47 for my $enclosures (@{$self->{enclosures}}) { 48 $self->log(info => "Play " . $enclosure->local_path); 49 $self->play($enclosure->local_path); 50 } 36 51 } 37 38 52 39 53 sub play { … … 51 65 =head1 SYNOPSIS 52 66 67 # play single file when feeds are updated 53 68 - module: Notify::Audio 54 69 config: 55 70 filename: /path/to/foo.wav 71 72 # play enclosures downloaded with Filter::FetchEnclosure 73 - module: Notify::Audio 74 config: 75 play_enclosures: 1 56 76 57 77 =head1 DESCRIPTION … … 65 85 =item filename 66 86 67 Audio filename to play. Required .87 Audio filename to play. Required, if you don't set I<play_enclosures>. 68 88 69 = back89 =item play_enclosures 70 90 71 =head1 TODO 72 73 =over 4 74 75 =item * 76 77 Configurable audio name per feed. 78 79 =item * 80 81 Play enclosures? 91 If set, it'll play local enclosure file which are downloaded via 92 Filter::FetchEnclosure, if any. 82 93 83 94 =back trunk/plagger/lib/Plagger/Plugin/Notify/Audio/iTunesWin32.pm
r1397 r1399 8 8 my($self, $filename) = @_; 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);
