summaryrefslogtreecommitdiff
path: root/MAT
diff options
context:
space:
mode:
authorTails developers2013-07-13 10:15:47 +0000
committerjvoisin2013-07-13 13:10:53 +0200
commit2968a48fd4e015983c3255fd4fc584c649abfd63 (patch)
tree013d5599e0e9c9b236d14c653be212182ca4b3a4 /MAT
parentf03dbf33f84e513bdd396fb8e13255fac5834a7d (diff)
Include list_supported_formats in the module
Diffstat (limited to 'MAT')
-rw-r--r--MAT/mat.py19
1 files changed, 18 insertions, 1 deletions
diff --git a/MAT/mat.py b/MAT/mat.py
index 90fb3cb..42e96df 100644
--- a/MAT/mat.py
+++ b/MAT/mat.py
@@ -13,7 +13,6 @@ import xml.sax
13import hachoir_core.cmd_line 13import hachoir_core.cmd_line
14import hachoir_parser 14import hachoir_parser
15 15
16
17__version__ = '0.4' 16__version__ = '0.4'
18__author__ = 'jvoisin' 17__author__ = 'jvoisin'
19 18
@@ -47,6 +46,24 @@ def get_datadir():
47 elif os.path.isdir('/usr/local/share/mat/'): 46 elif os.path.isdir('/usr/local/share/mat/'):
48 return '/usr/local/share/mat/' 47 return '/usr/local/share/mat/'
49 48
49def list_supported_formats():
50 '''
51 Return a list of all localy supported fileformat
52 '''
53 handler = XMLParser()
54 parser = xml.sax.make_parser()
55 parser.setContentHandler(handler)
56 path = os.path.join(get_datadir(), 'FORMATS')
57 with open(path, 'r') as xmlfile:
58 parser.parse(xmlfile)
59
60 localy_supported = []
61 for item in handler.list:
62 if strippers.STRIPPERS.has_key(item['mimetype'].split(',')[0]):
63 localy_supported.append(item)
64
65 return localy_supported
66
50class XMLParser(xml.sax.handler.ContentHandler): 67class XMLParser(xml.sax.handler.ContentHandler):
51 ''' 68 '''
52 Parse the supported format xml, and return a corresponding 69 Parse the supported format xml, and return a corresponding