⧼vector-jumptocontent⧽

Twitter: Difference between revisions

From EPrints Documentation
Cjg (talk | contribs)
New page: Adding a twitter channel to eprints is dead easy. <pre><nowiki> $c->{eprint_status_change} = sub { my( $eprint, $old_status, $new_status ) = @_; if( $new_status eq "arc...
 
Cjg (talk | contribs)
No edit summary
Line 1: Line 1:
Adding a twitter channel to eprints is dead easy.
Adding a twitter channel to eprints is dead easy.
First set up a twitter account for your repository.
Add the following to a .pl file in cfg.d/
Add the username and password for the account.


<pre><nowiki>
<pre><nowiki>
Line 19: Line 25:
  };
  };
</nowiki></pre>
</nowiki></pre>
Add your twitter to the list:
* http://twitter.com/eprintsecs - ECS EPrints, Southampton

Revision as of 15:06, 6 June 2008

Adding a twitter channel to eprints is dead easy.

First set up a twitter account for your repository.

Add the following to a .pl file in cfg.d/

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 &`;
        }
 };

Add your twitter to the list: