diff --git a/muk_converter/__manifest__.py b/muk_converter/__manifest__.py index 9363692..81bf9b8 100644 --- a/muk_converter/__manifest__.py +++ b/muk_converter/__manifest__.py @@ -20,7 +20,7 @@ { "name": "MuK Converter", "summary": """Universal Converter""", - "version": '11.0.1.2.4', + "version": '11.0.1.2.5', "category": 'Extra Tools', "license": "AGPL-3", "website": "https://www.mukit.at", diff --git a/muk_converter/models/converter.py b/muk_converter/models/converter.py index 513c972..b8b0d30 100644 --- a/muk_converter/models/converter.py +++ b/muk_converter/models/converter.py @@ -48,17 +48,22 @@ class Converter(models.AbstractModel): @api.model def convert(self, filename, content, format="pdf", recompute=False, store=True): binary_content = base64.b64decode(content) + output = self.convert_raw(filename, content, format=format, recompute=recompute, store=store) + return base64.b64encode(output) + + @api.model + def convert_raw(self, filename, binary_content, format="pdf", recompute=False, store=True): checksum = hashlib.sha1(binary_content).hexdigest() stored = self._retrieve(checksum, format) if not recompute and stored.exists(): - return base64.b64encode(stored.content) + return stored.content else: name = "%s.%s" % (filename, format) output = self._parse(filename, binary_content, format) if store: self._store(checksum, name, output, format, stored) - return base64.b64encode(output) - + return output + #---------------------------------------------------------- # Helper #---------------------------------------------------------- @@ -90,4 +95,4 @@ class Converter(models.AbstractModel): 'checksum': checksum, 'format': format, 'content_fname': filename, - 'content': content}) \ No newline at end of file + 'content': content})