[svn] r5427 - in trunk/tools/unoconv: . docs

packagers at lists.rpmforge.net packagers at lists.rpmforge.net
Sun May 20 14:57:35 CEST 2007


Author: dag
Date: 2007-05-20 14:57:35 +0200 (Sun, 20 May 2007)
New Revision: 5427

Added:
   trunk/tools/unoconv/docs/links.txt
Modified:
   trunk/tools/unoconv/ChangeLog
   trunk/tools/unoconv/TODO
   trunk/tools/unoconv/unoconv
   trunk/tools/unoconv/unoconv.spec
Log:
Option -d/--doctype now affects -l/--list

Modified: trunk/tools/unoconv/ChangeLog
===================================================================
--- trunk/tools/unoconv/ChangeLog	2007-05-20 12:14:13 UTC (rev 5426)
+++ trunk/tools/unoconv/ChangeLog	2007-05-20 12:57:35 UTC (rev 5427)
@@ -1,12 +1,13 @@
-* 0.1svn - released 20/05/2007
+* 0.2 - released 20/05/2007
 - Added support for almost 100 graphics, presentation and spreadsheet documents
-- Added -t/--type option to specify the document type
+- Added -d/--doctype option to specify the document type
 - Added -v/--verbose to show more information
 - Added Gentoo oofice path '/usr/lib/openoffice/program/' (Peter Draho)
 - Show proper error when file does not exist (Peter Draho)
 - Make long options work :)
 - If format is not recognized, scan by extension
 - Use glob to find possible location of pyuno
+- Option -d/--doctype now affects -l/--list
 
 * 0.1 - released 19/05/2007
 - Initial release

Modified: trunk/tools/unoconv/TODO
===================================================================
--- trunk/tools/unoconv/TODO	2007-05-20 12:14:13 UTC (rev 5426)
+++ trunk/tools/unoconv/TODO	2007-05-20 12:57:35 UTC (rev 5427)
@@ -12,3 +12,7 @@
 
 ### Usability
 - Start OpenOffice automatically to assist conversion and then stop
+- Maybe change the commandline interface to reflect ImageMagick's convert
+
+### Documentation
+- Add manpage

Added: trunk/tools/unoconv/docs/links.txt
===================================================================
--- trunk/tools/unoconv/docs/links.txt	                        (rev 0)
+++ trunk/tools/unoconv/docs/links.txt	2007-05-20 12:57:35 UTC (rev 5427)
@@ -0,0 +1,12 @@
+
++ Framework/Article/Filter/FilterList OOo 2 1
+  http://wiki.services.openoffice.org/wiki/Framework/Article/Filter/FilterList_OOo_2_1
+
++ UDK: UNO Development Kit
+  http://udk.openoffice.org/
+
++ Python-UNO bridge
+  http://udk.openoffice.org/python/python-bridge.html
+
++ OpenOffice.org developer manual
+  http://api.openoffice.org/DevelopersGuide/DevelopersGuide.html

Modified: trunk/tools/unoconv/unoconv
===================================================================
--- trunk/tools/unoconv/unoconv	2007-05-20 12:14:13 UTC (rev 5426)
+++ trunk/tools/unoconv/unoconv	2007-05-20 12:57:35 UTC (rev 5427)
@@ -40,7 +40,7 @@
 __version__ = "$Revision$"
 # $Source$
 
-VERSION = '0.1svn'
+VERSION = '0.2'
 
 class Fmt:
     def __init__(self, doctype, name, extension, summary, filter):
@@ -72,9 +72,12 @@
             if fmt.name == name and fmt.doctype == doctype:
                 return (fmt, )
     def display(self, doctype):
+        print >>sys.stderr, 'The following list of %s formats are currently available:' % doctype
+        print >>sys.stderr
         for fmt in self.list:
             if fmt.doctype == doctype:
                 print >>sys.stderr, "  %-8s - %s [.%s]" % (fmt.name, fmt.summary, fmt.extension)
+        print >>sys.stderr
 
 class OutputStream( unohelper.Base, XOutputStream ):
     def __init__( self ):
@@ -86,6 +89,7 @@
     def flush( self ):
         pass
 
+doctypes = ('document', 'graphics', 'presentation', 'spreadsheet')
 fmts = FmtList()
 
 ### Document / Writer
@@ -230,11 +234,11 @@
     print >>sys.stderr, '''Convert from and to any format supported by OpenOffice
 
 unoconv options:
-  -c, --connection=<conn>  use a custom connection string
-  -f, --format=format      specify the output format
+  -b, --backend=format     specify the output format
+  -c, --connection=string  use a custom connection string
+  -d, --doctype=type       specify document type (document, graphics, presentation, spreadsheet)
   -l, --list               list the available output formats
   -s, --stdout             write output to stdout
-  -t, --type=doctype       specify document type (document, spreadsheet, presentation, graphics)
 '''
 
 args = sys.argv[1:]
@@ -248,8 +252,8 @@
 connection = "uno:socket,host=%s,port=%s;urp;StarOffice.ComponentContext" % (server, port)
 
 try:
-    opts, args = getopt.getopt (args, 'c:e:f:hlst:v',
-                ['connection=', 'extension=', 'format=', 'help', 'list', 'stdout', 'type=', 'verbose', 'version'] )
+    opts, args = getopt.getopt (args, 'b:c:d:hl:st:v',
+                ['backend=', 'connection=', 'doctype=', 'help', 'list', 'stdout', 'verbose', 'version'] )
 except getopt.error, exc:
     print >>sys.stderr, 'unoconv: %s, try unoconv -h for a list of all the options' % str(exc)
     sys.exit(1)
@@ -258,45 +262,22 @@
     if opt in ['-h', '--help']:
         help()
         sys.exit(1)
+    elif opt in ['-b', '--backend']:
+        format = arg
     elif opt in ['-c', '--connection']:
         connection = arg
-    elif opt in ['-f', '--format']:
-        format = arg
+    elif opt in ['-d', '--doctype']:
+        doctype = arg
     elif opt in ['-l', '--list']:
         showlist = True
     elif opt in ['-s', '--stdout']:
         stdout = True
-    elif opt in ['-t', '--type']:
-        doctype = arg
     elif opt in ['-v', '--verbose']:
         verbose = verbose + 1
     elif opt in ['--version']:
         version()
         sys.exit(1)
 
-if not format:
-    format = 'pdf'
-    doctype = 'document'
-
-if showlist or format == 'list':
-    print >>sys.stderr, 'The following list of document formats are currently available:'
-    print >>sys.stderr
-    fmts.display('document')
-    print >>sys.stderr
-    print >>sys.stderr, 'The following list of graphics formats are currently available:'
-    print >>sys.stderr
-    fmts.display('graphics')
-    print >>sys.stderr
-    print >>sys.stderr, 'The following list of presentation formats are currently available:'
-    print >>sys.stderr
-    fmts.display('presentation')
-    print >>sys.stderr
-    print >>sys.stderr, 'The following list of spreadsheet formats are currently available:'
-    print >>sys.stderr
-    fmts.display('spreadsheet')
-    print >>sys.stderr
-    sys.exit(1)
-
 if verbose >= 3:
     print 'Verbosity set to level %d' % (verbose - 1)
 
@@ -310,6 +291,18 @@
     elif doctype.startswith('s'):
         doctype = 'spreadsheet'
 
+if showlist or format == 'list':
+    if doctype:
+        fmts.display(doctype)
+    else:
+        for t in doctypes:
+            fmts.display(t)
+    sys.exit(1)
+
+if not format:
+    format = 'pdf'
+    doctype = 'document'
+
 if not args:
     print >>sys.stderr, 'unoconv: you have to provide a filename as argument'
     print >>sys.stderr, 'Try `unoconv -h\' for more information.'
@@ -372,7 +365,7 @@
             doc = desktop.loadComponentFromURL( inputurl , "_blank", 0, inputprops )
     
             if not doc:
-                raise UnoException("Couldn't open stream for unknown reason", None)
+                raise UnoException("File could not be loaded by OpenOffice", None)
     
             if not stdout:
                 (outputfn, ext) = os.path.splitext(inputfn)
@@ -386,14 +379,15 @@
 
         except IOException, e:
             print >>sys.stderr, "unoconv: error during conversion: %s" % e.Message
-            print >>sys.stderr, "The provided document cannot be convert to `%s'." % format
+            print >>sys.stderr, "The provided document cannot be exported to %s [%s]." % (outputfmt.summary, outputfmt.extension)
             sys.exit(1)
 
         except CannotConvertException, e:
             print >>sys.stderr, "unoconv: convert error: %s" % e.Message
 
         except UnoException, e:
-            print >>sys.stderr, "unoconv: error (%s) during conversion: %s" % (repr(e.__class__), e.Message)
+            print >>sys.stderr, "unoconv: error during conversion: %s" % e.Message
+            print >>sys.stderr, "The provided document cannot be imported."
             rc = 1
             if doc:
                 doc.dispose()

Modified: trunk/tools/unoconv/unoconv.spec
===================================================================
--- trunk/tools/unoconv/unoconv.spec	2007-05-20 12:14:13 UTC (rev 5426)
+++ trunk/tools/unoconv/unoconv.spec	2007-05-20 12:57:35 UTC (rev 5427)
@@ -8,7 +8,7 @@
 
 Summary: Tool to convert between any document format supported by OpenOffice
 Name: unoconv
-Version: 0.1svn
+Version: 0.2
 Release: 1
 License: GPL
 Group: System Environment/Base
@@ -57,8 +57,8 @@
 %{_bindir}/unoconv
 
 %changelog
-* Sun May 20 2007 Dag Wieers <dag at wieers.com> - 0.1svn-1
-- Updated to release 0.1svn.
+* Sun May 20 2007 Dag Wieers <dag at wieers.com> - 0.2-1
+- Updated to release 0.2.
 
 * Sat May 19 2007 Dag Wieers <dag at wieers.com> - 0.1-1
 - Initial package. (using DAR)




More information about the commits mailing list