EPrints Technical Mailing List Archive
See the EPrints wiki for instructions on how to join this mailing list and related information.
Message: #07962
< Previous (by date) | Next (by date) > | < Previous (in thread) | Next (in thread) > | Messages - Most Recent First | Threads - Most Recent First
Re: [EP-tech] Action upon Lifting Embargo
- To: eprints-tech@ecs.soton.ac.uk, James Kerwin <jkerwin2101@gmail.com>
- Subject: Re: [EP-tech] Action upon Lifting Embargo
- From: James Kerwin <jkerwin2101@gmail.com>
- Date: Thu, 5 Sep 2019 12:01:26 +0100
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 expiryif( $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;
Beware of calling any perl modules that aren't in the core EPrints files; lift_embargos (my version at least) has:and so on...
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:
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!use FindBin;
use LWP::Authen::OAuth;
use lib "$FindBin::Bin/../perl_lib";
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).
Thanks,
James
On Mon, Sep 2, 2019 at 1:08 PM James Kerwin via Eprints-tech <eprints-tech@ecs.soton.ac.uk> wrote:
*** Options: http://mailman.ecs.soton.ac.uk/mailman/listinfo/eprints-techHi 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
*** Archive: http://www.eprints.org/tech.php/
*** EPrints community wiki: http://wiki.eprints.org/
*** EPrints developers Forum: http://forum.eprints.org/
- Follow-Ups:
- Re: [EP-tech] Action upon Lifting Embargo
- From: James Kerwin <jkerwin2101@gmail.com>
- Re: [EP-tech] Action upon Lifting Embargo
- References:
- [EP-tech] Action upon Lifting Embargo
- From: James Kerwin <jkerwin2101@gmail.com>
- Re: [EP-tech] Action upon Lifting Embargo
- From: James Kerwin <jkerwin2101@gmail.com>
- [EP-tech] Action upon Lifting Embargo
- Prev by Date: [EP-tech] Action upon Lifting Embargo
- Next by Date: [EP-tech] Mendeley Web Import and Eprints
- Previous by thread: [EP-tech] EPrints/CRIS
- Next by thread: [EP-tech] DOI handling in orcid_support_advance
- Index(es):