一応動いてる。TwitterからJaikuへポストした結果
※テストでは1件だけポストした。
※apikeyはココから
twitter2jaiku.yaml
global:
assets_path: /home/user/plagger/assets
timezone: Asia/Tokyo
log:
level: info
plugins:
- module: Subscription::Config
config:
feed:
- http://twitter.com/statuses/user_timeline/[twitter user].rss
- module: Filter::BreakEntriesToFeeds
config:
use_entry_title: 1
- module: Publish::Jaiku
config:
username: [user name]
userkey: [your api key]
Plagger/Plugin/Publish/Jaiku.pm
package Plagger::Plugin::Publish::Jaiku;
use strict;
use base qw( Plagger::Plugin );
use Encode;
use Net::Jaiku;
use Time::HiRes qw(sleep);
sub register {
my($self, $context) = @_;
$context->register_hook(
$self,
'publish.entry' => \&publish_entry,
'plugin.init' => \&initialize,
);
}
sub initialize {
my($self, $context) = @_;
my %opt = (
username => $self->conf->{username},
userkey => $self->conf->{userkey},
);
$self->{jaiku} = Net::Jaiku->new(%opt);
}
sub publish_entry {
my($self, $context, $args) = @_;
my $body = $self->templatize('jaiku.tt', $args);
# TODO: FIX when Summary configurable.
if ( length($body) > 159 ) {
$body = substr($body, 0, 159);
}
$context->log(info => "Updating Jaiku status to '$body'");
$self->{jaiku}->setPresence( message => encode_utf8($body) ) or $context->error("Can't update jaiku status");
my $sleeping_time = $self->conf->{interval} || 15;
$context->log(info => "sleep $sleeping_time.");
sleep( $sleeping_time );
}
1;
__END__
=head1 NAME
Plagger::Plugin::Publish::Jaiku - Update your status with feeds
=head1 SYNOPSIS
- module: Publish::Jaiku
config:
username: jaiku-id
userkey: jaiku-apikey
=head1 DESCRIPTION
This plugin sends feed entries summary to your jaiku account status.
=head1 CONFIG
=over 4
=item username
Jaiku username. Required.
=item userkey
Jaiku apikey. Required.
=item interval
Optional.
=item timeout
Optional.
=back
=head1 AUTHOR
Yasuhiro Matsumoto
=head1 SEE ALSO
L<Plagger>, L<Net::Jaiku>
=cut
assets/plugins/Publish-Jaiku/jaiku.tt
[% IF entry.body %][% entry.body_text %][% ELSE %][% entry.title_text %][% END %] [% entry.permalink %]
どこに納品するかが分かりません。
追記 CodeReposにcommitしました。