Commit 7a664bb7511c0b3f76f9e584b73c12dca5899077
1 parent
415c53a4
KTS-2513
"Add params for host and port to OOo doc converter" Added. Committed By: Kevin Fourie Reviewed By: Conrad Vermeulen git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@7402 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
6 additions
and
4 deletions
bin/openoffice/DocumentConverter.py
| ... | ... | @@ -7,7 +7,9 @@ |
| 7 | 7 | # Copyright (C) 2007 Mirko Nasato <mirko@artofsolving.com> |
| 8 | 8 | # Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html |
| 9 | 9 | # |
| 10 | -DEFAULT_OPENOFFICE_PORT = 8100 | |
| 10 | +# Modified by Kevin Fourie <kevin@knowledgetree.com> - 2007-10-18 | |
| 11 | + | |
| 12 | +#DEFAULT_OPENOFFICE_PORT = 8100 | |
| 11 | 13 | |
| 12 | 14 | import uno |
| 13 | 15 | from os.path import abspath, splitext |
| ... | ... | @@ -78,11 +80,11 @@ def _unoProps(**args): |
| 78 | 80 | |
| 79 | 81 | class DocumentConverter: |
| 80 | 82 | |
| 81 | - def __init__(self, port=DEFAULT_OPENOFFICE_PORT): | |
| 83 | + def __init__(self, host=argv[3], port=argv[4]): | |
| 82 | 84 | localContext = uno.getComponentContext() |
| 83 | 85 | resolver = localContext.ServiceManager.createInstanceWithContext("com.sun.star.bridge.UnoUrlResolver", localContext) |
| 84 | 86 | try: |
| 85 | - context = resolver.resolve("uno:socket,host=localhost,port=%s;urp;StarOffice.ComponentContext" % port) | |
| 87 | + context = resolver.resolve("uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (host, port)) | |
| 86 | 88 | except NoConnectException: |
| 87 | 89 | raise DocumentConversionException, "failed to connect to OpenOffice.org on port %s" % port |
| 88 | 90 | self.desktop = context.ServiceManager.createInstanceWithContext("com.sun.star.frame.Desktop", context) |
| ... | ... | @@ -127,7 +129,7 @@ if __name__ == "__main__": |
| 127 | 129 | from sys import argv, exit |
| 128 | 130 | |
| 129 | 131 | if len(argv) < 3: |
| 130 | - print "USAGE: " + argv[0] + " <input-file> <output-file>" | |
| 132 | + print "USAGE: " + argv[0] + " <input-file> <output-file> <host> <port>" | |
| 131 | 133 | exit(255) |
| 132 | 134 | |
| 133 | 135 | try: | ... | ... |