diff options
| author | jvoisin | 2015-07-28 23:18:25 +0200 |
|---|---|---|
| committer | jvoisin | 2015-07-28 23:18:25 +0200 |
| commit | d397ab99d1da7eba5db2dc14c68dec9bcd479b8d (patch) | |
| tree | 4ff0b70007bd746d0c8968d3fd1301d8ead0dbd4 /libmat/mat.py | |
| parent | 6ba3e3f20d7d52895bc44f9fc35b068cfce47133 (diff) | |
Distance MAT a bit more from hachoir
Diffstat (limited to 'libmat/mat.py')
| -rw-r--r-- | libmat/mat.py | 9 |
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 | |||
| 9 | import platform | 9 | import platform |
| 10 | import subprocess | 10 | import subprocess |
| 11 | import xml.sax | 11 | import xml.sax |
| 12 | import mimetypes | ||
| 12 | 13 | ||
| 13 | import hachoir_core.cmd_line | 14 | import hachoir_core.cmd_line |
| 14 | import hachoir_parser | 15 | import 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]: |
