Skip to content

Instantly share code, notes, and snippets.

@mattn
Created April 13, 2009 15:15
Show Gist options
  • Select an option

  • Save mattn/94490 to your computer and use it in GitHub Desktop.

Select an option

Save mattn/94490 to your computer and use it in GitHub Desktop.
#!perl
use strict;
use warnings;
use Encode;
use GNTP::Growl;
use Net::Wassr;
use Date::Format;
use Config::Pit;
my $application = 'GrowlWassr';
my @events = ('Hitokoto');
my $config = pit_get(
$application,
require => {
'wassr_username' => 'your username on wassr',
'wassr_password' => 'your password on wassr',
'growl_password' => 'your password on growl',
}
);
my $tweet = Net::Wassr->new(
user => $config->{wassr_username},
passwd => $config->{wassr_password},
);
my $growl = GNTP::Growl->new(
AppName => $application,
Password => $config->{growl_password},
);
$growl->register( [ map( { Name => $_, Enabled => 'True' }, @events ) ] );
my $last_id;
while (1) {
my @statuses = $tweet->friends_timeline(
{
count => 50,
since_id => $last_id,
id => $config->{wassr_username}
}
);
$last_id = undef;
for my $status ( @{ $statuses[0] } ) {
$last_id = $status->{id} unless $last_id;
$growl->notify(
Event => $events[0],
Icon => encode_utf8( $status->{user}{profile_image_url} ),
Title => encode_utf8( $status->{user}{screen_name} ),
Message => encode_utf8( $status->{text} )
);
sleep 6;
}
sleep 20;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment