Plagger::Plugin::Notify::Beep - Beep your computer when feed arrives


Plagger documentation Contained in the Plagger distribution.

Index


Code Index:

NAME

Top

Plagger::Plugin::Notify::Beep - Beep your computer when feed arrives

SYNOPSIS

Top

  - module: Notify::Beep
    config:
      music: "g' f bes' c8 f d4 c8 f d4 bes c g f2"

DESCRIPTION

Top

Beep your computer when feed arrives.

CONFIG

Top

music

When it is set, beep tries to play a melody specified as Lilypond notation. Defaults to nothing and in that case, it just beeps.

AUTHOR

Top

Tatsuhiko Miyagawa

SEE ALSO

Top

Plagger, Audio::Beep


Plagger documentation Contained in the Plagger distribution.

package Plagger::Plugin::Notify::Beep;
use strict;
use base qw( Plagger::Plugin );

use Audio::Beep;

sub register {
    my($self, $context) = @_;
    $context->register_hook(
        $self,
        'publish.feed' => \&update,
        'publish.finalize' => \&finalize,
    );
    $self->{count} = 0;
}

sub update {
    my($self, $context, $args) = @_;
    $self->{count}++ if $args->{feed}->count;
}

sub finalize {
    my($self, $context, $args) = @_;
    if ($self->{count}) {
        if ($self->conf->{music}) {
            Audio::Beep->new->play($self->conf->{music});
        } else {
            Audio::Beep::beep;
        }
    }
}

1;

__END__