Run EXIFTOOL always regardless of MIME type
Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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=('*',))
|
||||
|
||||
Reference in New Issue
Block a user