Mercurial > hg > sworduploader
comparison sworduploader.py @ 1:2ceacc9bb602
Added README and LICENSE.txt files
author | Marco Fabiani <marco.fabiani@eecs.qmul.ac.uk> |
---|---|
date | Wed, 28 Mar 2012 11:16:56 +0100 |
parents | 71b6185352a5 |
children | c72d6b5d58bc |
comparison
equal
deleted
inserted
replaced
0:71b6185352a5 | 1:2ceacc9bb602 |
---|---|
1 #!usr/bin/env/ python | 1 #!usr/bin/env/ python |
2 # dspaceuploader.py | 2 |
3 # Copyright: Marco Fabiani, Centre for Digital Music, Queen Mary University of London | 3 """ SWORD2 DSpace bulk uploader |
4 # License: XXXXXX | 4 |
5 A python script to submit large numbers of files to a SWORD2-compatible repository, specifically DSpace 1.8x. | |
6 Built on the SWORD2 python client library: https://bitbucket.org/beno/python-sword2/overview | |
7 | |
8 Dependencies: | |
9 | |
10 - python 2.X | |
11 | |
12 - sword2 library: https://bitbucket.org/beno/python-sword2/src | |
13 | |
14 ----------------------------------- | |
15 Copyright 2012 Marco Fabiani | |
16 Copyright 2012 Queen Mary, University of London | |
17 ----------------------------------- | |
18 """ | |
5 | 19 |
6 import argparse, getpass, zipfile,os,sys | 20 import argparse, getpass, zipfile,os,sys |
7 from sword2 import * | 21 from sword2 import * |
8 | 22 |
9 # Parse arguments | 23 # Parse arguments |
10 parser = argparse.ArgumentParser(description="Bulk upload to DSpace using SWORDv2.",epilog="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.") | 24 parser = argparse.ArgumentParser(description="Bulk upload to DSpace using SWORDv2.",epilog="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.") |
11 parser.add_argument("data", type=str, nargs=1, | 25 parser.add_argument("data", type=str, nargs=1, |
12 help="Accepts: METSDSpaceSIP packages, zip files, directories, single files") | 26 help="Accepts: METSDSpaceSIP packages, zip files, directories, single files. NOTE: METSDSpaceSIP packages are only accepted by Collections with a workflow!") |
13 parser.add_argument("--username", dest="user_name", type=str,nargs=1, help="DSpace username.") | 27 parser.add_argument("--username", dest="user_name", type=str,nargs=1, help="DSpace username.") |
14 parser.add_argument("--title", dest="title", type=str,nargs=1, help="Title (ignored for METS packages).") | 28 parser.add_argument("--title", dest="title", type=str,nargs=1, help="Title (ignored for METS packages).") |
15 parser.add_argument("--author", dest="author", type=str,nargs="+", help="Author(s) (ignored for METS packages). Accepts multiple entries in the format \"Surname, Name\"") | 29 parser.add_argument("--author", dest="author", type=str,nargs="+", help="Author(s) (ignored for METS packages). Accepts multiple entries in the format \"Surname, Name\"") |
16 parser.add_argument("--date", dest="date", type=str,nargs=1, help="Date of creation (string) (ignored for METS packages).") | 30 parser.add_argument("--date", dest="date", type=str,nargs=1, help="Date of creation (string) (ignored for METS packages).") |
17 parser.add_argument("--servicedoc", dest="dspaceurl", type=str,nargs=1, help="Url of the SWORDv2 service document (default: c4dm).") | 31 parser.add_argument("--servicedoc", dest="dspaceurl", type=str,nargs=1, help="Url of the SWORDv2 service document (default: http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/servicedocument") |
18 | 32 |
19 args = parser.parse_args() | 33 args = parser.parse_args() |
20 data = args.data[0] | 34 data = args.data[0] |
21 if args.dspaceurl == None: | 35 if args.dspaceurl == None: |
22 dspaceurl = "http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/servicedocument" | 36 dspaceurl = "http://c4dm.eecs.qmul.ac.uk/smdmrd-test/swordv2/servicedocument" |