-
Notifications
You must be signed in to change notification settings - Fork 2
/
MimeTypes.py
34 lines (29 loc) · 1.52 KB
/
MimeTypes.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
class mimeTypes(object):
def getDictionary(self):
mimetype_to_extension = {}
extension_to_mimetype = {}
mimetype_to_extension['text/plain'] = 'txt'
mimetype_to_extension['text/xml'] = 'xml'
mimetype_to_extension['text/css'] = 'css'
mimetype_to_extension['text/javascript'] = 'js'
mimetype_to_extension['text/rtf'] = 'rtf'
mimetype_to_extension['text/calendar'] = 'ics'
mimetype_to_extension['application/msword'] = 'doc'
mimetype_to_extension['application/msexcel'] = 'xls'
mimetype_to_extension['application/x-msword'] = 'doc'
mimetype_to_extension['application/vnd.ms-excel'] = 'xls'
mimetype_to_extension['application/vnd.ms-powerpoint'] = 'ppt'
mimetype_to_extension['application/pdf'] = 'pdf'
mimetype_to_extension['text/comma-separated-values'] = 'csv'
mimetype_to_extension['image/jpeg'] = 'jpg'
mimetype_to_extension['image/gif'] = 'gif'
mimetype_to_extension['image/jpg'] = 'jpg'
mimetype_to_extension['image/tiff'] = 'tiff'
mimetype_to_extension['image/png'] = 'png'
# And hacky reverse lookups
for mimetype in mimetype_to_extension:
extension_to_mimetype[mimetype_to_extension[mimetype]] = mimetype
mimetype_extension_mapping = {}
mimetype_extension_mapping.update(mimetype_to_extension)
mimetype_extension_mapping.update(extension_to_mimetype)
return mimetype_extension_mapping