3 \2R@s ddlZddlZddlZddlZy ddlZWnek rDdZYnXdddddddd d d d d dg Zdddddddddg Z da da GdddZ d5ddZ d6ddZd7ddZd8ddZd9dd Zdd Zd d!Zeed"krddlZd#Zd:d%d&Zy&ejejd'dd(d)d*d+g\ZZWn0ejk rNZzed'eWYddZ[XnXd'ZdZxDeD]<\ZZ ed;krzednedN knownfilesinited MimeTypes guess_typeguess_all_extensionsguess_extensionadd_typeinitread_mime_types suffix_map encodings_map types_map common_typesz/etc/mime.typesz/etc/httpd/mime.typesz/etc/httpd/conf/mime.typesz/etc/apache/mime.typesz/etc/apache2/mime.typesz$/usr/local/etc/httpd/conf/mime.typesz"/usr/local/lib/netscape/mime.typesz/usr/local/etc/mime.typesFc@s`eZdZfdfddZdddZdddZddd Zdd d Zdd d ZdddZ dddZ dS)rTcCsts ttj|_tj|_iif|_iif|_x"tjD]\}}|j||dq.enum_typesr5z Content Type)r>OpenKeyZHKEY_CLASSES_ROOT startswithZ QueryValueExZREG_SZrr?)rrr@ZhkcrZ subkeynameZsubkeyZmimetypeZdatatyperrrread_windows_registrys     zMimeTypes.read_windows_registryN)T)T)T)T)T)T)T) __name__ __module__ __qualname__rrrrrrr0rDrrrrr:s  >   TcCstdkrttj||S)N)_dbr r)r)rrrrrscCstdkrttj||S)N)rHr r)rrrrrr&s cCstdkrttj||S)N)rHr r)rrrrrr7s cCstdkrttj|||S)N)rHr r)rrrrrrrGs cCsndat}|dkr"tr|jt}x"|D]}tjj|r(|j|q(W|j a |j a |j da |j da |a dS)NTF)rrr>rDrospathisfilerr r r rrH)filesdbfilerrrr Xs    cCsNy t|}Wntk r dSX|t}|j|d|jdSQRXdS)NT)r/OSErrorrr0r )rNfrMrrrr ls  cCsDdddddddadddd d ad d d d d ddddd ddddddddd ddddd dd ddddd d d!d"d#d#d#d$d%dd&d'd(d(d)d*ddd+d$d,d-d.d.d/d'd'd'd'd0ddd d d1d2d3d4d5d2d6dd7d8d9d9d:d9d9d d9d;dd?d@dAdBdCdDdDdEdFdd dGdHdIdJdKdBdLdMdNdOdOdPdPdBdQddRdSdTdUdd@dVdWdXdWdYd@dZd@d[d\d]ad^d_d_d`d`d`dadbdcadS)dNz.svg.gzz.tar.gzz.tar.bz2z.tar.xz)z.svgzz.tgzz.tazz.tzz.tbz2z.txzZgzipcompressZbzip2Zxz)z.gzz.Zz.bz2z.xzzapplication/octet-streamzapplication/postscriptz audio/x-aiffz audio/basiczvideo/x-msvideoz text/plainzapplication/x-bcpiozimage/x-ms-bmpzapplication/x-cdfzapplication/x-netcdfzapplication/x-cpiozapplication/x-cshztext/cssztext/csvzapplication/mswordzapplication/x-dvizmessage/rfc822z text/x-setextz image/gifzapplication/x-gtarzapplication/x-hdfz text/htmlzimage/vnd.microsoft.iconz image/iefz image/jpegzapplication/javascriptzapplication/jsonzapplication/x-latexz video/mpegzapplication/vnd.apple.mpegurlzapplication/x-troff-manzapplication/x-troff-mezapplication/x-mifzvideo/quicktimezvideo/x-sgi-moviez audio/mpegz video/mp4zapplication/x-troff-mszapplication/odazapplication/x-pkcs12zapplication/pkcs7-mimezimage/x-portable-bitmapzapplication/pdfzimage/x-portable-graymapz image/pngzimage/x-portable-anymapzapplication/vnd.ms-powerpointzimage/x-portable-pixmapz text/x-pythonzapplication/x-python-codezaudio/x-pn-realaudiozapplication/x-pn-realaudiozimage/x-cmu-rasterzapplication/xmlz image/x-rgbzapplication/x-troffz text/richtextz text/x-sgmlzapplication/x-shzapplication/x-sharzapplication/x-wais-sourcezapplication/x-sv4cpiozapplication/x-sv4crcz image/svg+xmlzapplication/x-shockwave-flashzapplication/x-tarzapplication/x-tclzapplication/x-texzapplication/x-texinfoz image/tiffztext/tab-separated-valueszapplication/x-ustarz text/x-vcardz audio/x-wavz video/webmzimage/x-xbitmapzapplication/vnd.ms-excelzapplication/excelztext/xmlzimage/x-xpixmapzimage/x-xwindowdumpzapplication/zip)z.az.aiz.aifz.aifcz.aiffz.auz.aviz.batz.bcpioz.binz.bmpz.cz.cdfz.cdfz.cpioz.cshz.cssz.csvz.dllz.docz.dotz.dviz.emlz.epsz.etxz.exez.gifz.gtarz.hz.hdfz.htmz.htmlz.icoz.iefz.jpez.jpegz.jpgz.jsz.jsonz.kshz.latexz.m1vz.m3uz.m3u8z.manz.mez.mhtz.mhtmlz.mifz.mjsz.movz.moviez.mp2z.mp3z.mp4z.mpaz.mpez.mpegz.mpgz.msz.ncz.nwsz.oz.objz.odaz.p12z.p7cz.pbmz.pdfz.pfxz.pgmz.plz.pngz.pnmz.potz.ppaz.ppmz.ppsz.pptz.psz.pwzz.pyz.pycz.pyoz.qtz.raz.ramz.rasz.rdfz.rgbz.roffz.rtxz.sgmz.sgmlz.shz.sharz.sndz.soz.srcz.sv4cpioz.sv4crcz.svgz.swfz.tz.tarz.tclz.texz.texiz.texinfoz.tifz.tiffz.trz.tsvz.txtz.ustarz.vcfz.wavz.webmz.wizz.wsdlz.xbmz.xlbz.xlsz.xlsz.xmlz.xpdlz.xpmz.xslz.xwdz.zipz image/jpgz audio/midiz image/pictzapplication/rtfztext/xul)z.jpgz.midz.midiz.pctz.picz.pictz.rtfz.xul)r r r rrrrr_default_mime_typesws( rR__main__a4Usage: mimetypes.py [options] type Options: --help / -h -- print this message and exit --lenient / -l -- additionally search of some common, but non-standard types. --extension / -e -- guess extension instead of type More than one type argument may be given. rAcCs"tt|rt|tj|dS)N)printUSAGEsysexit)codemsgrrrusage;srZr4ZhlehelpZlenient extension-h--help-l --lenient-e --extensionz I don't know anything about typeztype:z encoding:)T)T)T)T)N)rA)r]r^)r_r`)rarb)%rIrVr&Z urllib.parser#winregr> ImportError__all__rrrHrrrrrr r rRrEZgetoptrUrZargvZoptsargserrorrYrr\optargZgtypeZguessrTr,rrrrsz   V      3