summaryrefslogtreecommitdiff
path: root/libmat/mat.py
diff options
context:
space:
mode:
authorjvoisin2015-07-28 23:18:25 +0200
committerjvoisin2015-07-28 23:18:25 +0200
commitd397ab99d1da7eba5db2dc14c68dec9bcd479b8d (patch)
tree4ff0b70007bd746d0c8968d3fd1301d8ead0dbd4 /libmat/mat.py
parent6ba3e3f20d7d52895bc44f9fc35b068cfce47133 (diff)
Distance MAT a bit more from hachoir
Diffstat (limited to 'libmat/mat.py')
-rw-r--r--libmat/mat.py9
1 files changed, 6 insertions, 3 deletions
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
9import platform 9import platform
10import subprocess 10import subprocess
11import xml.sax 11import xml.sax
12import mimetypes
12 13
13import hachoir_core.cmd_line 14import hachoir_core.cmd_line
14import hachoir_parser 15import hachoir_parser
@@ -166,10 +167,12 @@ def create_class_file(name, backup, **kwargs):
166 167
167 parser = hachoir_parser.createParser(filename) 168 parser = hachoir_parser.createParser(filename)
168 if not parser: 169 if not parser:
169 logging.info('Unable to parse %s' % filename) 170 logging.info('Unable to parse %s with hachoir' % filename)
170 return None
171 171
172 mime = parser.mime_type 172 mime = mimetypes.guess_type(filename)[0]
173 if not mime:
174 logging.info('Unable to find mimetype of %s' % filename)
175 return None
173 176
174 if mime == 'application/zip': # some formats are zipped stuff 177 if mime == 'application/zip': # some formats are zipped stuff
175 if mimetypes.guess_type(name)[0]: 178 if mimetypes.guess_type(name)[0]: