Difference between revisions of "Twitter"
Line 1: | Line 1: | ||
+ | [[Category:Plugins]] | ||
== Adding a twitter channel to eprints is dead easy. == | == Adding a twitter channel to eprints is dead easy. == | ||
Revision as of 17:12, 8 February 2010
Contents
Adding a twitter channel to eprints is dead easy.
First set up a twitter account for your repository.
Add the following to a new .pl file in cfg.d/
You could name this file twitter.pl, for example
Add the username and password for the account.
$c->{eprint_status_change} = sub { my( $eprint, $old_status, $new_status ) = @_; if( $new_status eq "archive" ) { my $twitter_username="username"; my $twitter_password="password"; my $cmd1 = "curl -s 'http://is.gd/api.php?longurl=".$eprint->get_url."'"; my $shorturl = `$cmd1`; my $title = $eprint->get_value( "title" ); $title =~ s/'/\\'/g; my $cmd2 = "curl --basic -s --user $twitter_username:$twitter_password --data status='$title - $shorturl' http://twitter.com/statuses/update.xml"; `$cmd2 &`; } };
Couple of things to look out for:
- Make sure you have CURL installed, as the script invokes this from the command line
- Restart Apache ( /etc/init.d/apache2 force-reload , or similar)
- Then log in and deposit an item to test
Add your twitter to the list:
- http://twitter.com/eprintsecs - ECS EPrints, Southampton