diff --git a/HISTORY.rst b/HISTORY.rst index 5016d38d2d..585c2040bf 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -57,6 +57,8 @@ - Add entrypoint commands to run single workers, single gunicorn or single celery commands like "flower". - Add platform template to return queues for a worker. +- Update the EXIFTOOL driver to run for all documents + regardless of MIME type. 3.2.6 (2019-07-10) diff --git a/mayan/apps/file_metadata/drivers/exiftool.py b/mayan/apps/file_metadata/drivers/exiftool.py index cff210335e..28eb3f065c 100644 --- a/mayan/apps/file_metadata/drivers/exiftool.py +++ b/mayan/apps/file_metadata/drivers/exiftool.py @@ -40,8 +40,15 @@ class EXIFToolDriver(FileMetadataDriver): try: document_version.save_to_file(file_object=temporary_fileobject) temporary_fileobject.seek(0) - result = self.command_exiftool(temporary_fileobject.name) - return json.loads(s=result.stdout)[0] + try: + result = self.command_exiftool(temporary_fileobject.name) + except sh.ErrorReturnCode_1 as exception: + result = json.loads(s=exception.stdout)[0] + if result.get('Error', '') == 'Unknown file type': + # Not a fatal error + return result + else: + return json.loads(s=result.stdout)[0] finally: temporary_fileobject.close() else: @@ -56,31 +63,4 @@ class EXIFToolDriver(FileMetadataDriver): ).get('exiftool_path', DEFAULT_EXIF_PATH) -EXIFToolDriver.register( - mimetypes=( - 'application/msword', - 'application/pdf', - 'application/vnd.oasis.opendocument.text', - 'application/vnd.openxmlformats-officedocument.presentationml.presentation', - 'application/x-bittorrent', - 'application/x-gzip', - 'application/x-rar-compressed', - 'application/x-shockwave-flash', - 'application/zip', - 'application/zip', - 'audio/x-pn-realaudio-plugin', - 'audio/x-wav', - 'image/jpeg', - 'image/png', - 'image/svg+xml', - 'image/tiff', - 'image/x-portable-pixmap', - 'text/html', - 'text/rtf', - 'text/x-sh', - 'video/mp4', - 'video/webm', - 'video/x-flv', - 'video/x-matroska' - ) -) +EXIFToolDriver.register(mimetypes=('*',))