-
Notifications
You must be signed in to change notification settings - Fork 14
/
helper.py
123 lines (123 loc) · 3.79 KB
/
helper.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# Part of RedFile
#
# Author: Outflank B.V. / Mark Bergman / @xychix
#
# License : BSD3
def getContentType(ext):
dd = { "a": "application/octet-stream",
"ai": "application/postscript",
"aif": "audio/x-aiff",
"aifc": "audio/x-aiff",
"aiff": "audio/x-aiff",
"au": "audio/basic",
"avi": "video/x-m svideo",
"bat": "text/plain",
"bin": "application/octet-stream",
"bmp": "image/x-ms-bmp",
"c": "text/plain",
"cdf": "application/x-cdf",
"csh": "application/x-csh",
"css": "text/css",
"dll": "application/octet-stream",
"doc": "application/msword",
"dot": "application/msword",
"dvi": "application/x-dvi",
"eml": "message/rfc822",
"eps": "application/postscript",
"etx": "text/x-setext",
"exe": "application/octet-stream",
"gif": "image/gif",
"gtar": "application/x-gtar",
"h": "text/plain",
"hdf": "application/x-hdf",
"htm": "text/html",
"html": "text/html",
"jpe": "image/jpeg",
"jpeg": "image/jpeg",
"jpg": "image/jpeg",
"js": "application/x-javascript",
"json": "application/json",
"ksh": "text/plain",
"latex": "application/x-latex",
"m1v": "video/mpeg",
"man": "application/x-troff-man",
"me": "application/x-troff-me",
"mht": "message/rfc822",
"mhtml": "message/rfc822",
"mif": "application/x-mif",
"mov": "video/quicktime",
"movie": "video/x-sgi-movie",
"mp2": "audio/mpeg",
"mp3": "audio/mpeg",
"mp4": "video/mp4",
"mpa": "video/mpeg",
"mpe": "video/mpeg",
"mpeg": "video/mpeg",
"mpg": "video/mpeg",
"ms": "application/x-troff-ms",
"nc": "application/x-netcdf",
"nws": "message/rfc822",
"o": "application/octet-stream",
"obj": "application/octet-stream",
"oda": "application/oda",
"pbm": "image/x-portable-bitmap",
"pdf": "application/pdf",
"pfx": "application/x-pkcs12",
"pgm": "image/x-portable-graymap",
"png": "image/png",
"pnm": "image/x-portable-anymap",
"pot": "application/vnd.ms-powerpoint",
"ppa": "application/vnd.ms-powerpoint",
"ppm": "image/x-portable-pixmap",
"pps": "application/vnd.ms-powerpoint",
"ppt": "application/vnd.ms-powerpoint",
"pptx": "application/vnd.ms-powerpoint",
"ps": "application/postscript",
"pwz": "application/vnd.ms-powerpoint",
"py": "text/x-python",
"pyc": "application/x-python-code",
"pyo": "application/x-python-code",
"qt": "video/quicktime",
"ra": "audio/x-pn-realaudio",
"ram": "application/x-pn-realaudio",
"ras": "image/x-cmu-raster",
"rdf": "application/xml",
"rgb": "image/x-rgb",
"roff": "application/x-troff",
"rtx": "text/richtext",
"sgm": "text/x-sgml",
"sgml": "text/x-sgml",
"sh": "application/x-sh",
"shar": "application/x-shar",
"snd": "audio/basic",
"so": "application/octet-stream",
"src": "application/x-wais-source",
"swf": "application/x-shockwave-flash",
"t": "application/x-troff",
"tar": "application/x-tar",
"tcl": "application/x-tcl",
"tex": "application/x-tex",
"texi": "application/x-texinfo",
"texinfo": "application/x-texinfo",
"tif": "image/tiff",
"tiff": "image/tiff",
"tr": "application/x-troff",
"tsv": "text/tab-separated-values",
"txt": "text/plain",
"ustar": "application/x-ustar",
"vcf": "text/x-vcard",
"wav": "audio/x-wav",
"wiz": "application/msword",
"wsdl": "application/xml",
"xbm": "image/x-xbitmap",
"xlb": "application/vnd.ms-excel",
"xls": "application/vnd.ms-e xcel",
"xlsx": "application/vnd.ms-excel",
"xml": "text/xml",
"xpdl": "application/xml",
"xpm": "image/x-xpixmap",
"xsl": "application/xml",
"xwd": "image/x-xwindowdump",
"zip": "application/zip"}
if ext in dd: return(dd[ext])
else: return('plain/unknown')