From d397ab99d1da7eba5db2dc14c68dec9bcd479b8d Mon Sep 17 00:00:00 2001 From: jvoisin Date: Tue, 28 Jul 2015 23:18:25 +0200 Subject: Distance MAT a bit more from hachoir --- libmat/mat.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'libmat/mat.py') diff --git a/libmat/mat.py b/libmat/mat.py index 954b9a3..d0fd504 100644 --- a/libmat/mat.py +++ b/libmat/mat.py @@ -9,6 +9,7 @@ import os import platform import subprocess import xml.sax +import mimetypes import hachoir_core.cmd_line import hachoir_parser @@ -166,10 +167,12 @@ def create_class_file(name, backup, **kwargs): parser = hachoir_parser.createParser(filename) if not parser: - logging.info('Unable to parse %s' % filename) - return None + logging.info('Unable to parse %s with hachoir' % filename) - mime = parser.mime_type + mime = mimetypes.guess_type(filename)[0] + if not mime: + logging.info('Unable to find mimetype of %s' % filename) + return None if mime == 'application/zip': # some formats are zipped stuff if mimetypes.guess_type(name)[0]: -- cgit v1.3