[EP-tech] add docs2eprint - need help
Ulf Laube
ulf.laube at ontochem.com
Fri May 4 13:09:53 BST 2012
Hello,
if I add many documents to an eprints, only first doc is shown on screen, but
all docs are stored in file system. What wrong on code?
tree -s ./archives/repos01/documents/disk0/00/00/00/02/
./archives/repos01/documents/disk0/00/00/00/02/
├── [ 4096] 01
│ └── [ 2721976] bla.pdf
├── [ 4096] 02
│ └── [ 80227] bla.xml
├── [ 4096] 03
│ └── [ 411] bla.txt
http://eprints/2/ :
--------------------
[img] Plain Text
bla.pdf
Download (2658Kb)
[img] Plain Text
Download (0b)
[img] Plain Text
Download (0b)
source code :
----------------
$ep_session = new EPrints::Session( 1, $ep_archiveid );
$ep_dataset = $ep_session->get_repository->get_dataset( 'inbox' );
$eprint = EPrints::DataObj::EPrint::create( $ep_session,$ep_dataset );
...
$eprint->commit();
# doc 1 - pdf
$doc = EPrints::DataObj::Document::create( $ep_session, $eprint );
$doc_file_name = basename( $file_pdf );
$doc->set_value( "format", "text/plain" );
$doc->add_file( $file_pdf, "$doc_file_name" );
$doc->set_value( "main", $doc_file_name );
$doc->commit;
# doc 2 - xml
$doc = EPrints::DataObj::Document::create( $ep_session, $eprint );
$doc_file_name = basename( $file_xml );
$doc->set_value( "format", "text/plain" );
$doc->add_file( $file_xml, "$doc_file_name" );
$doc->commit;
# doc 3 - txt
$doc = EPrints::DataObj::Document::create( $ep_session, $eprint );
$doc_file_name = basename( $file_lic );
$doc->set_value( "format", "text/plain" );
$doc->add_file( $file_lic, "$doc_file_name" );
$doc->commit;
$eprint->generate_static;
$ep_session->terminate();
Thanks for helping or ideas
regards
ulf
--
OntoChem GmbH
Heinrich-Damerow-Str. 4
06120 Halle (Saale)
Germany
Tel. +49-345-478047-4
Fax: +49-345-478047-1
HRB 215461 Amtsgericht Stendal; USt-IdNr.: DE246232735
More information about the Eprints-tech
mailing list