root/trunk/plagger/lib/Plagger/Plugin/Notify/Audio.pm

Revision 1395 (checked in by miyagawa, 14 years ago)

Notify::Audio rough cut. Untested

Line 
1 package Plagger::Plugin::Notify::Audio;
2 use strict;
3 use base qw( Plagger::Plugin::Notify::Eject );
4
5 sub init {
6     my $self = shift;
7     $self->SUPER::init(@_);
8
9     my $player = $self->conf->{player} || $^O;
10     my $class  = 'Plagger::Plugin::Notify::Audio::' . $player;
11     eval "require $class;";
12     if ($@) {
13         Plagger->context->error("Notify plugin doesn't run on your platform $player");
14     }
15     bless $self, $class;
16 }
17
18 sub eject {
19     my($self, $context, $args) = @_;
20     $self->play($context, $self->conf->{filename});
21 }
22
23 sub play {
24     my($self, $context, $args) = @_;
25     $self->log(warn => "Subclass should override this");
26 }
27
28 1;
29 __END__
30
31 =head1 NAME
32
33 Plagger::Plugin::Notify::Audio - Notifies feed updates via audio file
34
35 =head1 SYNOPSIS
36
37   - module: Notify::Audio
38     config:
39       filename: /path/to/foo.wav
40
41 =head1 DESCRIPTION
42
43 This plugin plays audio file when you've got feed updates.
44
45 =head1 CONFIG
46
47 =over 4
48
49 =item filename
50
51 Audio filename to play. Required.
52
53 =head1 AUTHOR
54
55 Tatsuhiko Miyagawa
56
57 =head1 SEE ALSO
58
59 L<Plagger>
60
61 =cut
Note: See TracBrowser for help on using the browser.