Drop support for UNOCONV
This commit is contained in:
@@ -13,8 +13,6 @@ register_settings(
|
||||
{'name': u'GM_PATH', 'global_name': u'CONVERTER_GM_PATH', 'default': u'/usr/bin/gm', 'description': _(u'File path to graphicsmagick\'s program.'), 'exists': True},
|
||||
{'name': u'GM_SETTINGS', 'global_name': u'CONVERTER_GM_SETTINGS', 'default': u''},
|
||||
{'name': u'GRAPHICS_BACKEND', 'global_name': u'CONVERTER_GRAPHICS_BACKEND', 'default': u'converter.backends.python', 'description': _(u'Graphics conversion backend to use. Options are: converter.backends.imagemagick, converter.backends.graphicsmagick and converter.backends.python.')},
|
||||
{'name': u'UNOCONV_PATH', 'global_name': u'CONVERTER_UNOCONV_PATH', 'default': u'/usr/bin/unoconv', 'exists': True, 'description': _(u'Path to the unoconv program.')},
|
||||
{'name': u'UNOCONV_USE_PIPE', 'global_name': u'CONVERTER_UNOCONV_USE_PIPE', 'default': True, 'description': _(u'Use alternate method of connection to LibreOffice using a pipe, it is slower but less prone to segmentation faults.')},
|
||||
{'name': u'LIBREOFFICE_PATH', 'global_name': u'CONVERTER_LIBREOFFICE_PATH', 'default': u'/usr/bin/libreoffice', 'exists': True, 'description': _(u'Path to the libreoffice program.')},
|
||||
|
||||
#{'name': u'OCR_OPTIONS', 'global_name': u'CONVERTER_OCR_OPTIONS', 'default': u'-colorspace Gray -depth 8 -resample 200x200'},
|
||||
|
||||
@@ -8,7 +8,7 @@ from mimetype.api import get_mimetype
|
||||
from common.conf.settings import TEMPORARY_DIRECTORY
|
||||
from common.utils import id_generator
|
||||
|
||||
from .conf.settings import UNOCONV_PATH, UNOCONV_USE_PIPE, LIBREOFFICE_PATH
|
||||
from .conf.settings import LIBREOFFICE_PATH
|
||||
from .exceptions import (OfficeConversionError,
|
||||
OfficeBackendError, UnknownFileFormat)
|
||||
|
||||
@@ -79,47 +79,6 @@ class OfficeConverter(object):
|
||||
return str(self.__unicode__())
|
||||
|
||||
|
||||
class OfficeConverterBackendUnoconv(object):
|
||||
def __init__(self):
|
||||
self.unoconv_path = UNOCONV_PATH if UNOCONV_PATH else u'/usr/bin/unoconv'
|
||||
if not os.path.exists(self.unoconv_path):
|
||||
raise OfficeBackendError('cannot find unoconv executable')
|
||||
|
||||
def convert(self, input_filepath, output_filepath):
|
||||
"""
|
||||
Executes the program unoconv using subprocess's Popen
|
||||
"""
|
||||
self.input_filepath = input_filepath
|
||||
self.output_filepath = output_filepath
|
||||
|
||||
command = []
|
||||
command.append(self.unoconv_path)
|
||||
|
||||
if UNOCONV_USE_PIPE:
|
||||
command.append(u'--pipe')
|
||||
command.append(u'mayan-%s' % id_generator())
|
||||
|
||||
command.append(u'--format')
|
||||
command.append(u'pdf')
|
||||
command.append(u'--output')
|
||||
command.append(self.output_filepath)
|
||||
command.append(self.input_filepath)
|
||||
|
||||
try:
|
||||
proc = subprocess.Popen(command, close_fds=True, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
|
||||
return_code = proc.wait()
|
||||
logger.debug('return_code: %s' % return_code)
|
||||
|
||||
readline = proc.stderr.readline()
|
||||
logger.debug('stderr: %s' % readline)
|
||||
if return_code != 0:
|
||||
raise OfficeBackendError(readline)
|
||||
except OSError, msg:
|
||||
raise OfficeBackendError(msg)
|
||||
except Exception, msg:
|
||||
logger.error('Unhandled exception', exc_info=msg)
|
||||
|
||||
|
||||
class OfficeConverterBackendDirect(object):
|
||||
def __init__(self):
|
||||
self.libreoffice_path = LIBREOFFICE_PATH if LIBREOFFICE_PATH else u'/usr/bin/libreoffice'
|
||||
|
||||
@@ -151,20 +151,6 @@ Webserver
|
||||
OCR
|
||||
---
|
||||
|
||||
**Q: The included version of ``unoconv`` in my distribution is too old**
|
||||
|
||||
* Only the file 'unoconv' file from https://github.com/dagwieers/unoconv is needed.
|
||||
Put it in a user designated directory for binaries such as /usr/local/bin and
|
||||
setup Mayan's configuration option in your settings_local.py file like this::
|
||||
|
||||
CONVERTER_UNOCONV_PATH = '/usr/local/bin/unoconv'
|
||||
|
||||
If you already have office or text documents uploaded into **Mayan EDMS**,
|
||||
after setting up and testing ``unoconv`` by hand, go to 'Tools',
|
||||
'Maintenance', 'Update office documents' page count', this will force a
|
||||
re-detection and re-processing of any document found to be of office format.
|
||||
|
||||
|
||||
Deployments
|
||||
-----------
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Mayan EDMS v0.12.3 release notes
|
||||
================================
|
||||
|
||||
*October 2012*
|
||||
*December 2012*
|
||||
|
||||
This is the third maintenance release of the 0.12 series.
|
||||
|
||||
@@ -55,6 +55,8 @@ their clients with customized setups without having to access their clients'
|
||||
**Mayan EDMS** instances. ``JSON``, ``YAML`` and a custom ``YAML`` format
|
||||
(http://djangosnippets.org/snippets/2461/) are supported by this new app.
|
||||
|
||||
#TODO: Add repository sync
|
||||
|
||||
Translation updates
|
||||
~~~~~~~~~~~~~~~~~~~
|
||||
The translation for all the current languages were synchronized to the
|
||||
@@ -77,6 +79,8 @@ is now more aptly named metadata members which adds or removes metadata types in
|
||||
single organizational unit. An error that caused a duplicate menu link in the
|
||||
document type filename view was also fixed.
|
||||
|
||||
#TODO: Add removal of UNOCONV
|
||||
|
||||
Optimizations
|
||||
~~~~~~~~~~~~~
|
||||
Inspired by the idea of getting **Mayan EDMS** running effectively on low power hardware such as
|
||||
|
||||
@@ -8,7 +8,6 @@ The philosophy in place is to try to avoid having users download a documents and
|
||||
visualization tool too. The conversion backend is a stack of functions,
|
||||
first the mimetype is evaluated, if it is an office document it is passed
|
||||
to LibreOffice_ working in headless mode (and managed by supervisor_)
|
||||
via unoconv_ (more information about ``unoconv`` can be found in the :doc:`FAQ section <../faq/index>`)
|
||||
for conversion to PDF_. The PDF_ is stored in a temporary
|
||||
cache along side all the other files that were not office documents,
|
||||
from here they are inspected to determine the page count and the
|
||||
@@ -39,5 +38,4 @@ which defaults to '/usr/bin/libreoffice'.
|
||||
|
||||
.. _PDF: http://en.wikipedia.org/wiki/Portable_Document_Format
|
||||
.. _LibreOffice: http://www.libreoffice.org/
|
||||
.. _unoconv: https://github.com/dagwieers/unoconv/
|
||||
.. _supervisor: http://supervisord.org/introduction.html
|
||||
|
||||
@@ -192,26 +192,6 @@ fine tune it's functionality as explained in the `GraphicsMagick documentation`_
|
||||
|
||||
.. _GraphicsMagick documentation: http://www.graphicsmagick.org/convert.html#conv-opti
|
||||
|
||||
|
||||
.. setting:: CONVERTER_UNOCONV_PATH
|
||||
|
||||
|
||||
**CONVERTER_UNOCONV_PATH**
|
||||
|
||||
Default: ``/usr/bin/unoconv``
|
||||
|
||||
Path to the unoconv program used to call LibreOffice for office document conversion.
|
||||
|
||||
|
||||
.. setting:: CONVERTER_UNOCONV_USE_PIPE
|
||||
|
||||
|
||||
**CONVERTER_UNOCONV_USE_PIPE**
|
||||
|
||||
Default: ``True``
|
||||
|
||||
Use alternate method of connection to LibreOffice using a pipe, it is slower but less prone to segmentation faults.
|
||||
|
||||
|
||||
.. setting:: CONVERTER_LIBREOFFICE_PATH
|
||||
|
||||
|
||||
Reference in New Issue
Block a user