After a few days on head-banging and follicle scratching (not that I have much hair left these days), I have a proof-of-concept for multiple deposit.
One script, one package, and transfer the same package to multiple repositories!
I need to know the following things:
- The host (eg OpenDepot.org)
- The URL for the collection (eg ‘/sword/deposit/123456789/2’)
- The user name to deposit as, encoded (such as name%40some.domain)
- The password for that user name (in plain text: myUselessPassword)
I have tested this with OpenDepot, JorumOpen, and ShareGeoOpen
The basic Perl code is pretty easy too:
$ua = LWP::UserAgent->new(); $req = HTTP::Request->new( POST => 'http://'.$username.":".$password."@".$host.$collection ); $req->header( 'X-Packaging' => 'http://purl.org/net/sword-types/METSDSpaceSIP', 'X-No-Op' => 'false', 'X-Verbose' => 'false', 'Content-Disposition' => "filename=$filename" ); $req->content_type( 'application/zip' ); $req->content( $file_contents ); $res = $ua->request($req); print $res->is_success ? "Deposit successful.\n" : $res->status_line, "\n"
…. stick in an appropriate loop, and you have multiple depositing.
Leave a Reply