Wiki » History » Version 12

Steve Welburn, 2013-01-22 02:02 PM

1 1 Marco Fabiani
h1. Wiki
2 1 Marco Fabiani
3 3 Marco Fabiani
h2. Usage
4 3 Marco Fabiani
5 3 Marco Fabiani
SWORD2 DSpace bulk uploader
6 3 Marco Fabiani
--------------------
7 3 Marco Fabiani
8 3 Marco Fabiani
A python script to submit large numbers of files to a SWORD2-compatible repository, specifically DSpace 1.8x.
9 3 Marco Fabiani
Built on the SWORD2 python client library: https://github.com/swordapp/python-client-sword2
10 3 Marco Fabiani
11 3 Marco Fabiani
-----------------------------------------------
12 3 Marco Fabiani
Installation:
13 3 Marco Fabiani
14 3 Marco Fabiani
- no installation required, simply copy the script sworduploader.py to a suitable location. The first time you run the script, it will create the sword2_logging.conf file.
15 12 Steve Welburn
-- However it does have two prerequisites:
16 11 Steve Welburn
--- argparse 
17 1 Marco Fabiani
--- swordv2
18 12 Steve Welburn
---- The version available via pip is incompatible with this uploader
19 12 Steve Welburn
---- The version at https://github.com/swordapp/python-client-sword2 is the official version, but works with a 30 second timeout
20 12 Steve Welburn
---- The version at https://github.com/sjwqmul/python-client-sword2 is out fork, and allows the timeout value to be specified
21 12 Steve Welburn
-- lxml may be required by the swordv2 client under certain (undefined) circumstances...
22 3 Marco Fabiani
- a server.cfg file is also available. If the --servicedoc option is not used, sworduploader will read the first line of server.cfg and use it as the server's URL. If the server.cfg is missing, it will default to C4DM's server.
23 3 Marco Fabiani
24 3 Marco Fabiani
-----------------------------------------------
25 3 Marco Fabiani
Usage:
26 3 Marco Fabiani
27 5 Marco Fabiani
<pre>
28 3 Marco Fabiani
sworduploader[-h] [--username USER_NAME] [--title TITLE]
29 3 Marco Fabiani
                        [--author AUTHOR [AUTHOR ...]] [--date DATE]
30 3 Marco Fabiani
                        [--servicedoc DSPACEURL]
31 3 Marco Fabiani
                        data
32 3 Marco Fabiani
33 3 Marco Fabiani
Bulk upload to DSpace using SWORDv2.
34 3 Marco Fabiani
35 3 Marco Fabiani
positional arguments:
36 3 Marco Fabiani
  data                  Accepts: METSDSpaceSIP and BagIt packages, simple zip
37 3 Marco Fabiani
                        files, directories, single files. NOTE: METSDSpaceSIP
38 3 Marco Fabiani
                        packages are only accepted by Collections with a
39 3 Marco Fabiani
                        workflow!
40 3 Marco Fabiani
41 3 Marco Fabiani
optional arguments:
42 3 Marco Fabiani
  -h, --help            show this help message and exit
43 3 Marco Fabiani
  --username USER_NAME  DSpace username.
44 3 Marco Fabiani
  --title TITLE         Title (ignored for METS packages).
45 3 Marco Fabiani
  --author AUTHOR [AUTHOR ...]
46 3 Marco Fabiani
                        Author(s) (ignored for METS packages). Accepts
47 3 Marco Fabiani
                        multiple entries in the format "Surname, Name"
48 3 Marco Fabiani
  --date DATE           Date of creation (string) (ignored for METS packages).
49 3 Marco Fabiani
  --zip                 If "data" is a directory, compress it and post it as a
50 3 Marco Fabiani
                        single file. The zip file will be saved along with the
51 3 Marco Fabiani
                        individual files.
52 3 Marco Fabiani
  --servicedoc SD  		Url of the SWORDv2 service document (default: use
53 3 Marco Fabiani
                        server.cfg if available, otherwise http://c4dm.eecs.qm
54 1 Marco Fabiani
                        ul.ac.uk/rdr/swordv2/servicedocument
55 5 Marco Fabiani
</pre>
56 6 Marco Fabiani
If the submission is created successfully, it will remain open to be completed with the necessary metadata and licenses, using the DSpace web interface. The submission can be found in the "My Account -> Submissions" section of the user's area.
57 3 Marco Fabiani
58 2 Marco Fabiani
h2. Updates
59 2 Marco Fabiani
60 2 Marco Fabiani
Version 0.6:
61 2 Marco Fabiani
- Uploading a directory will maintain the path structure (i.e. subdirectories).
62 2 Marco Fabiani
- A different server can be specified in the server.cfg file. This is overridden if the --servicedoc option is used. If the file is missing, sworduploader will default to C4DM's repository.
63 2 Marco Fabiani
64 1 Marco Fabiani
h2. Possible problems
65 1 Marco Fabiani
66 1 Marco Fabiani
Version 0.4 is based on the modified python-sword2 library that can be found on bitbucket/marcofabiani.
67 1 Marco Fabiani
68 1 Marco Fabiani
The script has been tested with the version now on github (richardjones), and it works IF DSpace is patched with the latest version of the sword-server-2.0 which corrects a mistake in the service document.
69 1 Marco Fabiani
70 1 Marco Fabiani
Issue 1: Service document verification fails (DSpace server)
71 1 Marco Fabiani
https://bitbucket.org/richardjones/python-sword2/issue/1/service-document-verification-fails-dspace
72 1 Marco Fabiani
73 1 Marco Fabiani
richardjones on Fri, 20 Apr 2012 12:45:26 +0200:
74 1 Marco Fabiani
75 1 Marco Fabiani
The bug was in the Java common library used by default
76 1 Marco Fabiani
77 1 Marco Fabiani
See http://tools.ietf.org/html/draft-gregorio-atompub-multipart-04 for details of multipart support requirements.
78 1 Marco Fabiani
79 1 Marco Fabiani
This has now been fixed in the java server library, which is hosted at http://sword-app.svn.sourceforge.net/viewvc/sword-app/JavaServer2.0/trunk/
80 1 Marco Fabiani
81 1 Marco Fabiani
Changes:
82 1 Marco Fabiani
 status: new -> resolved
83 7 Marco Fabiani
84 7 Marco Fabiani
h2. Executables
85 7 Marco Fabiani
86 10 Marco Fabiani
The executables for Mac and Windows have been produced using "PyInstaller":http://www.pyinstaller.org/. Note that currently (v0.6) building the executables fails when using the latest version of the swordv2 python libraries from GitHub, although the script works when used with python. Thus, the executables are based on a different version of the the libraries, which are included here under sword2-libraries-pyinstaller-compatible.