[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[EP-tech] Action upon Lifting Embargo

Hello again,

I managed to make EPrints do what I wanted. Most of you will know how to do
this I imagine, but if anybody relatively new to EPrints is curious, here
is how I did it (no guarantees that this is the best way to do it!).

I looked in lift_embargos and found:

# post-processing, eg. send notification of embargo expiry

if( $session->can_call( "notify_embargo_expiry" ) )


$session->call( "notify_embargo_expiry", $eprint, $doc );


So, being a lazy bones and completing a million greps to establish I didn't
have a pre-existing "notify_embargo_expiry" function I wrote my own in a
.pl file in archives/*archive_id*/cfg/cfg.d:

$c->{notify_embargo_expiry} = sub


use LWP::Authen::OAuth;

and so on...

Beware of calling any perl modules that aren't in the core EPrints files;
lift_embargos (my version at least) has:

use lib "$FindBin::Bin/../perl_lib";

This prevented LWP::Authen::OAuth from being loaded, but because this
module has "@ISA = qw( LWP::UserAgent );" it went straight to that without
loading the intended module. This then allowed the script to run and
successfully complete, but gave warnings on the command line as some of the
properties passed to it were not expected.

To get around that I just changed the top of lift_embargos to:

use FindBin;
*use LWP::Authen::OAuth;*
use lib "$FindBin::Bin/../perl_lib";

including the module before the use lib call. It doesn't seem to have
broken anything so I'm happy. We now have tweets and the ability to process
some metadata to make useful hashtags!

I borrowed heavily from:


Adding some bits (like hashtag stuff from keywords) and removing others (I
think the link shortening was giving me some grief and appears to be
unnecessary on Twitter now).


On Mon, Sep 2, 2019 at 1:08 PM James Kerwin via Eprints-tech <
eprints-tech at ecs.soton.ac.uk> wrote:

> Hi All,
> I have yet another, probably simple, question to ask.
> I have a script that does something (sends a tweets if anybody is
> interested...) on an EPrint status change using:
> $c->{eprint_status_change} = sub {
> It quickly escapes if an item has an embargo on it. I then want a slightly
> different version of the same script to run when embargoes are lifted.
> Is there a way to make this happen? I'm currently looking at
> bin/lift_embargos and seeing where I can drop a call to my script in there.
> I was wondering if there was a better or more proper way to make this
> happen?
> I have tried to look at the EPrints documentation, but not managed to find
> what I want.
> Thanks,
> James
> *** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-tech
> *** Archive: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.eprints.org%2Ftech.php%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C002af68e9bb2440d27ac08d731f06f25%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=Zh590BV1gOD3mmwHeW6rqWgoLG0FtwkLI7mnb97Gmm4%3D&amp;reserved=0
> *** EPrints community wiki: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwiki.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C002af68e9bb2440d27ac08d731f06f25%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=fYwt3pXBEqaHkxU3fgR%2Fc4KoHG6k9ivUlQxE%2F1eOhmo%3D&amp;reserved=0
> *** EPrints developers Forum: https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fforum.eprints.org%2F&amp;data=01%7C01%7Ceprints-tech%40ecs.soton.ac.uk%7C002af68e9bb2440d27ac08d731f06f25%7C4a5378f929f44d3ebe89669d03ada9d8%7C0&amp;sdata=rWevLLAkB7eHOmIMB%2F69nPfCcHR0cSqxC0zahRrO0Xc%3D&amp;reserved=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ecs.soton.ac.uk/pipermail/eprints-tech/attachments/20190905/2f01c837/attachment.html