Commit 3d465c9b by minad

mediatype helpers added, use bacon instead of test-spec, freedesktop.org.xml updated

parent c3fd8c42
......@@ -14,12 +14,13 @@ class MimeMagic
@subtype = @type.split('/')[1]
end
# Add custom mime type. You have to
# specify the type, a string list of file extensions,
# a string list of parent mime types and an optional
# detector block for magic detection.
# Add custom mime type. Arguments:
# * <i>type</i>: Mime type
# * <i>extensions</i>: String list of file extensions
# * <i>parents</i>: String list of parent mime types
# * <i>magics</i>: Mime magic specification array
def self.add(type, extensions, parents, *magics)
TYPES[type] = [extensions, parents, block_given? ? proc(&block) : nil]
TYPES[type] = [extensions, parents, magics]
extensions.each do |ext|
EXTENSIONS[ext] = type
end
......@@ -31,6 +32,16 @@ class MimeMagic
child_of? 'text/plain'
end
# Returns true if type is image
def image?
mediatype == 'image'
end
# Mediatype shortcuts
def image?; mediatype == 'image'; end
def audio?; mediatype == 'audio'; end
def video?; mediatype == 'video'; end
# Returns true if type is child of parent type
def child_of?(parent)
child?(type, parent)
......@@ -48,14 +59,14 @@ class MimeMagic
mime ? new(mime) : nil
end
# Lookup mime type by magic content analysis
# That could be slow
def self.by_magic(content)
if String === content
content.force_encoding('ascii-8bit') if content.respond_to? :force_encoding
content = StringIO.new(content.to_s, 'rb')
# Lookup mime type by magic content analysis.
# This is a slow operation.
def self.by_magic(io)
if !(io.respond_to?(:seek) && io.respond_to?(:read))
io = io.to_s
io.force_encoding('ascii-8bit') if io.respond_to?(:force_encoding)
io = StringIO.new(io, 'rb')
end
io = content.respond_to?(:seek) ? content : StringIO.new(content.to_s, 'rb')
mime = MAGIC.find {|type, matches| magic_match(io, matches) }
mime ? new(mime[0]) : nil
end
......@@ -73,8 +84,7 @@ class MimeMagic
private
def child?(child, parent)
return true if child == parent
TYPES.key?(child) ? TYPES[child][1].any? {|p| child?(p, parent) } : false
child == parent || TYPES.key?(child) && TYPES[child][1].any? {|p| child?(p, parent) }
end
def self.magic_match(io, matches)
......@@ -91,4 +101,6 @@ class MimeMagic
rescue
false
end
private_class_method :magic_match
end
# Generated from /usr/share/mime/packages/freedesktop.org.xml
# Generated from freedesktop.org.xml
class MimeMagic
private
EXTENSIONS = {
......@@ -30,6 +30,7 @@ class MimeMagic
'alz' => 'application/x-alz',
'amr' => 'audio/AMR',
'ani' => 'application/x-navi-animation',
'anx' => 'application/annodex',
'ape' => 'audio/x-ape',
'arj' => 'application/x-arj',
'arw' => 'image/x-sony-arw',
......@@ -45,6 +46,8 @@ class MimeMagic
'aw' => 'application/x-applix-word',
'awb' => 'audio/AMR-WB',
'awk' => 'application/x-awk',
'axa' => 'audio/annodex',
'axv' => 'video/annodex',
'bak' => 'application/x-trash',
'bcpio' => 'application/x-bcpio',
'bdf' => 'application/x-font-bdf',
......@@ -57,12 +60,15 @@ class MimeMagic
'bz2' => 'application/x-bzip',
'c' => 'text/x-c++src',
'c++' => 'text/x-c++src',
'cab' => 'application/vnd.ms-cab-compressed',
'cb7' => 'application/x-cb7',
'cbr' => 'application/x-cbr',
'cbt' => 'application/x-cbt',
'cbz' => 'application/x-cbz',
'cc' => 'text/x-c++src',
'cdf' => 'application/x-netcdf',
'cdr' => 'application/vnd.corel-draw',
'cer' => 'application/x-x509-ca-cert',
'cer' => 'application/pkix-cert',
'cert' => 'application/x-x509-ca-cert',
'cgm' => 'image/cgm',
'chm' => 'application/x-chm',
......@@ -74,6 +80,7 @@ class MimeMagic
'cpio.gz' => 'application/x-cpio-compressed',
'cpp' => 'text/x-c++src',
'cr2' => 'image/x-canon-cr2',
'crl' => 'application/pkix-crl',
'crt' => 'application/x-x509-ca-cert',
'crw' => 'image/x-canon-crw',
'cs' => 'text/x-csharp',
......@@ -103,6 +110,8 @@ class MimeMagic
'dng' => 'image/x-adobe-dng',
'doc' => 'application/msword',
'docbook' => 'application/docbook+xml',
'docm' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'dot' => 'application/msword-template',
'dsl' => 'text/x-dsl',
'dtd' => 'application/xml-dtd',
......@@ -118,6 +127,7 @@ class MimeMagic
'eif' => 'text/x-eiffel',
'el' => 'text/x-emacs-lisp',
'emf' => 'image/x-emf',
'eml' => 'message/rfc822',
'emp' => 'application/vnd.emusic-emusic_package',
'ent' => 'application/xml-external-parsed-entity',
'eps' => 'image/x-eps',
......@@ -140,8 +150,9 @@ class MimeMagic
'f' => 'text/x-fortran',
'f90' => 'text/x-fortran',
'f95' => 'text/x-fortran',
'fb2' => 'application/x-fictionbook+xml',
'fig' => 'image/x-xfig',
'fits' => 'image/x-fits',
'fits' => 'image/fits',
'fl' => 'application/x-fluid',
'flac' => 'audio/x-flac',
'flc' => 'video/x-flic',
......@@ -149,6 +160,10 @@ class MimeMagic
'flv' => 'video/x-flv',
'flw' => 'application/x-kivio',
'fo' => 'text/x-xslfo',
'fodg' => 'application/vnd.oasis.opendocument.graphics-flat-xml',
'fodp' => 'application/vnd.oasis.opendocument.presentation-flat-xml',
'fods' => 'application/vnd.oasis.opendocument.spreadsheet-flat-xml',
'fodt' => 'application/vnd.oasis.opendocument.text-flat-xml',
'for' => 'text/x-fortran',
'g3' => 'image/fax-g3',
'gb' => 'application/x-gameboy-rom',
......@@ -172,7 +187,9 @@ class MimeMagic
'gplt' => 'application/x-gnuplot',
'gra' => 'application/x-graphite',
'gsf' => 'application/x-font-type1',
'gsm' => 'audio/x-gsm',
'gtar' => 'application/x-tar',
'gv' => 'text/vnd.graphviz',
'gvp' => 'text/x-google-video-pointer',
'gz' => 'application/x-gzip',
'h' => 'text/x-chdr',
......@@ -190,8 +207,10 @@ class MimeMagic
'hxx' => 'text/x-c++hdr',
'ica' => 'application/x-ica',
'icb' => 'image/x-tga',
'icc' => 'application/vnd.iccprofile',
'icm' => 'application/vnd.iccprofile',
'icns' => 'image/x-icns',
'ico' => 'image/x-ico',
'ico' => 'image/vnd.microsoft.icon',
'ics' => 'text/calendar',
'idl' => 'text/x-idl',
'ief' => 'image/ief',
......@@ -204,10 +223,13 @@ class MimeMagic
'iso' => 'application/x-cd-image',
'iso9660' => 'application/x-cd-image',
'it' => 'audio/x-it',
'it87' => 'application/x-it87',
'j2k' => 'image/jp2',
'jad' => 'text/vnd.sun.j2me.app-descriptor',
'jar' => 'application/x-java-archive',
'java' => 'text/x-java',
'jceks' => 'application/x-java-jce-keystore',
'jks' => 'application/x-java-keystore',
'jng' => 'image/x-jng',
'jnlp' => 'application/x-java-jnlp-file',
'jp2' => 'image/jp2',
......@@ -224,14 +246,20 @@ class MimeMagic
'karbon' => 'application/x-karbon',
'kdc' => 'image/x-kodak-kdc',
'kdelnk' => 'application/x-desktop',
'kexi' => 'application/x-kexiproject-sqlite2',
'kexic' => 'application/x-kexi-connectiondata',
'kexis' => 'application/x-kexiproject-shortcut',
'kfo' => 'application/x-kformula',
'kil' => 'application/x-killustrator',
'kino' => 'application/smil',
'kml' => 'application/vnd.google-earth.kml+xml',
'kmz' => 'application/vnd.google-earth.kmz',
'kon' => 'application/x-kontour',
'kpm' => 'application/x-kpovmodeler',
'kpr' => 'application/x-kpresenter',
'kpt' => 'application/x-kpresenter',
'kra' => 'application/x-krita',
'ks' => 'application/x-java-keystore',
'ksp' => 'application/x-kspread',
'kud' => 'application/x-kugar',
'kwd' => 'application/x-kword',
......@@ -250,6 +278,7 @@ class MimeMagic
'lws' => 'image/x-lws',
'ly' => 'text/x-lilypond',
'lyx' => 'application/x-lyx',
'lz' => 'application/x-lzip',
'lzh' => 'application/x-lha',
'lzma' => 'application/x-lzma',
'lzo' => 'application/x-lzop',
......@@ -267,8 +296,10 @@ class MimeMagic
'mbox' => 'application/mbox',
'md' => 'application/x-genesis-rom',
'mdb' => 'application/vnd.ms-access',
'mdi' => 'image/vnd.ms-modi',
'me' => 'text/x-troff-me',
'med' => 'audio/x-mod',
'metalink' => 'application/metalink+xml',
'mgp' => 'application/x-magicpoint',
'mid' => 'audio/midi',
'midi' => 'audio/midi',
......@@ -280,7 +311,7 @@ class MimeMagic
'mli' => 'text/x-ocaml',
'mm' => 'text/x-troff-mm',
'mmf' => 'application/x-smaf',
'mml' => 'text/mathml',
'mml' => 'application/mathml+xml',
'mng' => 'video/x-mng',
'mo' => 'application/x-gettext-translation',
'mo3' => 'audio/x-mo3',
......@@ -309,6 +340,7 @@ class MimeMagic
'msx' => 'application/x-msx-rom',
'mtm' => 'audio/x-mod',
'mup' => 'text/x-mup',
'mxf' => 'application/mxf',
'n64' => 'application/x-n64-rom',
'nb' => 'application/mathematica',
'nc' => 'application/x-netcdf',
......@@ -333,24 +365,28 @@ class MimeMagic
'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
'odt' => 'application/vnd.oasis.opendocument.text',
'oga' => 'audio/ogg',
'ogg' => 'application/ogg',
'ogg' => 'audio/ogg',
'ogm' => 'video/x-ogm+ogg',
'ogv' => 'video/ogg',
'ogx' => 'application/ogg',
'old' => 'application/x-trash',
'oleo' => 'application/x-oleo',
'opml' => 'text/x-opml+xml',
'ora' => 'image/openraster',
'orf' => 'image/x-olympus-orf',
'otc' => 'application/vnd.oasis.opendocument.chart-template',
'otf' => 'application/vnd.oasis.opendocument.formula-template',
'otg' => 'application/vnd.oasis.opendocument.graphics-template',
'oth' => 'application/vnd.oasis.opendocument.text-web',
'otp' => 'application/vnd.oasis.opendocument.presentation-template',
'ots' => 'application/vnd.oasis.opendocument.spreadsheet-template',
'ott' => 'application/vnd.oasis.opendocument.text-template',
'owl' => 'text/rdf',
'owl' => 'application/rdf+xml',
'oxt' => 'application/vnd.openofficeorg.extension',
'p' => 'text/x-pascal',
'p10' => 'application/pkcs10',
'p12' => 'application/x-pkcs12',
'p7b' => 'application/x-pkcs7-certificates',
'p7s' => 'application/pkcs7-signature',
'pack' => 'application/x-java-pack200',
'pak' => 'application/x-pak',
......@@ -364,7 +400,8 @@ class MimeMagic
'pcf.z' => 'application/x-font-pcf',
'pcl' => 'application/vnd.hp-pcl',
'pcx' => 'image/x-pcx',
'pdb' => 'application/x-palm-database',
'pdb' => 'application/x-aportisdoc',
'pdc' => 'application/x-aportisdoc',
'pdf' => 'application/pdf',
'pdf.bz2' => 'application/x-bzpdf',
'pdf.gz' => 'application/x-gzpdf',
......@@ -384,6 +421,7 @@ class MimeMagic
'pict1' => 'image/x-pict',
'pict2' => 'image/x-pict',
'pk' => 'application/x-tex-pk',
'pkipath' => 'application/pkix-pkipath',
'pkr' => 'application/pgp-keys',
'pl' => 'application/x-perl',
'pla' => 'audio/x-iriver-pla',
......@@ -394,20 +432,25 @@ class MimeMagic
'pnm' => 'image/x-portable-anymap',
'pntg' => 'image/x-macpaint',
'po' => 'text/x-gettext-translation',
'por' => 'application/x-spss-por',
'pot' => 'application/vnd.ms-powerpoint',
'ppm' => 'image/x-portable-pixmap',
'pps' => 'application/vnd.ms-powerpoint',
'ppsx' => 'application/vnd.openxmlformats-officedocument.presentationml.slideshow',
'ppt' => 'application/vnd.ms-powerpoint',
'pptm' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'ppz' => 'application/vnd.ms-powerpoint',
'prc' => 'application/x-palm-database',
'ps' => 'application/postscript',
'ps.bz2' => 'application/x-bzpostscript',
'ps.gz' => 'application/x-gzpostscript',
'psd' => 'image/x-psd',
'psd' => 'image/vnd.adobe.photoshop',
'psf' => 'application/x-font-linux-psf',
'psf.gz' => 'application/x-gz-font-linux-psf',
'psflib' => 'audio/x-psflib',
'psid' => 'audio/prs.sid',
'psw' => 'application/x-pocket-word',
'pw' => 'application/x-pw',
'py' => 'text/x-python',
'pyc' => 'application/x-python-bytecode',
......@@ -425,8 +468,8 @@ class MimeMagic
'raw' => 'image/x-panasonic-raw',
'rax' => 'audio/vnd.rn-realaudio',
'rb' => 'application/x-ruby',
'rdf' => 'text/rdf',
'rdfs' => 'text/rdf',
'rdf' => 'application/rdf+xml',
'rdfs' => 'application/rdf+xml',
'reg' => 'text/x-ms-regedit',
'rej' => 'application/x-reject',
'rgb' => 'image/x-rgb',
......@@ -449,6 +492,7 @@ class MimeMagic
's3m' => 'audio/x-s3m',
'sam' => 'application/x-amipro',
'sami' => 'application/x-sami',
'sav' => 'application/x-spss-sav',
'scm' => 'text/x-scheme',
'sda' => 'application/vnd.stardivision.draw',
'sdc' => 'application/vnd.stardivision.calc',
......@@ -485,10 +529,11 @@ class MimeMagic
'sms' => 'application/x-sms-rom',
'snd' => 'audio/basic',
'so' => 'application/x-sharedlib',
'spc' => 'application/x-pkcs7-certificates',
'spd' => 'application/x-font-speedo',
'spec' => 'text/x-rpm-spec',
'spl' => 'application/x-shockwave-flash',
'spx' => 'audio/x-speex',
'spx' => 'audio/ogg',
'sql' => 'text/x-sql',
'sr2' => 'image/x-sony-sr2',
'src' => 'application/x-wais-source',
......@@ -523,6 +568,7 @@ class MimeMagic
'tar.gz' => 'application/x-compressed-tar',
'tar.lzma' => 'application/x-lzma-compressed-tar',
'tar.lzo' => 'application/x-tzo',
'tar.xz' => 'application/x-xz-compressed-tar',
'tar.z' => 'application/x-tarz',
'tbz' => 'application/x-bzip-compressed-tar',
'tbz2' => 'application/x-bzip-compressed-tar',
......@@ -533,6 +579,7 @@ class MimeMagic
'tga' => 'image/x-tga',
'tgz' => 'application/x-compressed-tar',
'theme' => 'application/x-theme',
'themepack' => 'application/x-windows-themepack',
'tif' => 'image/tiff',
'tiff' => 'image/tiff',
'tk' => 'text/x-tcl',
......@@ -550,6 +597,7 @@ class MimeMagic
'ttf' => 'application/x-font-ttf',
'ttx' => 'application/x-font-ttx',
'txt' => 'text/plain',
'txz' => 'application/x-xz-compressed-tar',
'tzo' => 'application/x-tzo',
'ufraw' => 'application/x-ufraw',
'ui' => 'application/x-designer',
......@@ -560,6 +608,7 @@ class MimeMagic
'url' => 'text/x-uri',
'ustar' => 'application/x-ustar',
'vala' => 'text/x-vala',
'vapi' => 'text/x-vala',
'vcf' => 'text/directory',
'vcs' => 'text/calendar',
'vct' => 'text/directory',
......@@ -597,6 +646,7 @@ class MimeMagic
'wp6' => 'application/vnd.wordperfect',
'wpd' => 'application/vnd.wordperfect',
'wpg' => 'application/x-wpg',
'wpl' => 'application/vnd.ms-wpl',
'wpp' => 'application/vnd.wordperfect',
'wps' => 'application/vnd.ms-works',
'wri' => 'application/x-mswrite',
......@@ -623,6 +673,8 @@ class MimeMagic
'xll' => 'application/vnd.ms-excel',
'xlm' => 'application/vnd.ms-excel',
'xls' => 'application/vnd.ms-excel',
'xlsm' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'xlt' => 'application/vnd.ms-excel',
'xlw' => 'application/vnd.ms-excel',
'xm' => 'audio/x-xm',
......@@ -631,12 +683,13 @@ class MimeMagic
'xml' => 'application/xml',
'xpm' => 'image/x-xpixmap',
'xps' => 'application/vnd.ms-xpsdocument',
'xsl' => 'application/xml',
'xsl' => 'application/xslt+xml',
'xslfo' => 'text/x-xslfo',
'xslt' => 'application/xml',
'xslt' => 'application/xslt+xml',
'xspf' => 'application/xspf+xml',
'xul' => 'application/vnd.mozilla.xul+xml',
'xwd' => 'image/x-xwindowdump',
'xz' => 'application/x-xz',
'z' => 'application/x-compress',
'zabw' => 'application/x-abiword',
'zip' => 'application/zip',
......@@ -644,6 +697,7 @@ class MimeMagic
}
TYPES = {
'application/andrew-inset' => [["ez"], []],
'application/annodex' => [["anx"], []],
'application/atom+xml' => [["atom"], ["application/xml"]],
'application/dicom' => [["dcm"], []],
'application/docbook+xml' => [["docbook"], ["application/xml"]],
......@@ -651,53 +705,76 @@ class MimeMagic
'application/epub+zip' => [["epub"], []],
'application/gnunet-directory' => [["gnd"], []],
'application/illustrator' => [["ai"], []],
'application/javascript' => [["js"], ["text/plain"]],
'application/javascript' => [["js"], ["text/x-csrc"]],
'application/mathematica' => [["nb"], ["text/plain"]],
'application/mathml+xml' => [["mml"], ["application/xml"]],
'application/mbox' => [["mbox"], ["text/plain"]],
'application/metalink+xml' => [["metalink"], ["application/xml"]],
'application/msword' => [["doc"], ["application/x-ole-storage"]],
'application/msword-template' => [["dot"], ["application/msword"]],
'application/mxf' => [["mxf"], []],
'application/octet-stream' => [["bin"], []],
'application/oda' => [["oda"], []],
'application/ogg' => [["ogg", "ogx"], []],
'application/ogg' => [["ogx"], []],
'application/pdf' => [["pdf"], []],
'application/pgp-encrypted' => [["asc", "gpg", "pgp"], []],
'application/pgp-keys' => [["asc", "pkr", "skr"], ["text/plain"]],
'application/pkcs10' => [["p10"], []],
'application/pkcs7-signature' => [["p7s"], ["text/plain"]],
'application/pkix-cert' => [["cer"], []],
'application/pkix-crl' => [["crl"], []],
'application/pkix-pkipath' => [["pkipath"], []],
'application/postscript' => [["ps"], ["text/plain"]],
'application/ram' => [["ram"], ["text/plain"]],
'application/rdf+xml' => [["owl", "rdf", "rdfs"], ["application/xml"]],
'application/rss+xml' => [["rss"], ["application/xml"]],
'application/rtf' => [["rtf"], ["text/plain"]],
'application/sdp' => [["sdp"], []],
'application/sieve' => [["siv"], ["application/xml"]],
'application/smil' => [["kino", "smi", "smil", "sml"], ["application/xml"]],
'application/vnd.apple.mpegurl' => [["m3u", "m3u8"], []],
'application/vnd.corel-draw' => [["cdr"], []],
'application/vnd.emusic-emusic_package' => [["emp"], []],
'application/vnd.google-earth.kml+xml' => [["kml"], ["application/xml"]],
'application/vnd.google-earth.kmz' => [["kmz"], ["application/zip"]],
'application/vnd.hp-hpgl' => [["hpgl"], []],
'application/vnd.hp-pcl' => [["pcl"], []],
'application/vnd.iccprofile' => [["icc", "icm"], []],
'application/vnd.lotus-1-2-3' => [["123", "wk1", "wk3", "wk4", "wks"], []],
'application/vnd.mozilla.xul+xml' => [["xul"], ["application/xml"]],
'application/vnd.ms-access' => [["mdb"], []],
'application/vnd.ms-cab-compressed' => [["cab"], []],
'application/vnd.ms-excel' => [["xla", "xlc", "xld", "xll", "xlm", "xls", "xlt", "xlw"], []],
'application/vnd.ms-powerpoint' => [["pot", "pps", "ppt", "ppz"], []],
'application/vnd.ms-tnef' => [["tnef", "tnf"], []],
'application/vnd.ms-works' => [["wcm", "wdb", "wks", "wps"], ["application/x-ole-storage"]],
'application/vnd.ms-wpl' => [["wpl"], []],
'application/vnd.ms-xpsdocument' => [["xps"], ["application/zip"]],
'application/vnd.oasis.opendocument.chart' => [["odc"], ["application/zip"]],
'application/vnd.oasis.opendocument.chart-template' => [["otc"], ["application/zip"]],
'application/vnd.oasis.opendocument.database' => [["odb"], ["application/zip"]],
'application/vnd.oasis.opendocument.formula' => [["odf"], ["application/zip"]],
'application/vnd.oasis.opendocument.formula-template' => [["otf"], ["application/zip"]],
'application/vnd.oasis.opendocument.graphics' => [["odg"], ["application/zip"]],
'application/vnd.oasis.opendocument.graphics-flat-xml' => [["fodg"], ["application/xml"]],
'application/vnd.oasis.opendocument.graphics-template' => [["otg"], ["application/zip"]],
'application/vnd.oasis.opendocument.image' => [["odi"], ["application/zip"]],
'application/vnd.oasis.opendocument.presentation' => [["odp"], ["application/zip"]],
'application/vnd.oasis.opendocument.presentation-flat-xml' => [["fodp"], ["application/xml"]],
'application/vnd.oasis.opendocument.presentation-template' => [["otp"], ["application/zip"]],
'application/vnd.oasis.opendocument.spreadsheet' => [["ods"], ["application/zip"]],
'application/vnd.oasis.opendocument.spreadsheet-flat-xml' => [["fods"], ["application/xml"]],
'application/vnd.oasis.opendocument.spreadsheet-template' => [["ots"], ["application/zip"]],
'application/vnd.oasis.opendocument.text' => [["odt"], ["application/zip"]],
'application/vnd.oasis.opendocument.text-flat-xml' => [["fodt"], ["application/xml"]],
'application/vnd.oasis.opendocument.text-master' => [["odm"], ["application/zip"]],
'application/vnd.oasis.opendocument.text-template' => [["ott"], ["application/zip"]],
'application/vnd.oasis.opendocument.text-web' => [["oth"], ["application/zip"]],
'application/vnd.openofficeorg.extension' => [["oxt"], ["application/zip"]],
'application/vnd.openxmlformats-officedocument.presentationml.presentation' => [["pptm", "pptx"], ["application/zip"]],
'application/vnd.openxmlformats-officedocument.presentationml.slideshow' => [["ppsx"], ["application/zip"]],
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => [["xlsm", "xlsx"], ["application/zip"]],
'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => [["docm", "docx"], ["application/zip"]],
'application/vnd.rn-realmedia' => [["rm", "rmj", "rmm", "rms", "rmvb", "rmx"], []],
'application/vnd.stardivision.calc' => [["sdc"], []],
'application/vnd.stardivision.chart' => [["sds"], []],
......@@ -723,6 +800,7 @@ class MimeMagic
'application/x-ace' => [["ace"], []],
'application/x-alz' => [["alz"], []],
'application/x-amipro' => [["sam"], []],
'application/x-aportisdoc' => [["pdb", "pdc"], ["application/x-palm-database"]],
'application/x-applix-spreadsheet' => [["as"], []],
'application/x-applix-word' => [["aw"], []],
'application/x-archive' => [["a"], []],
......@@ -734,10 +812,12 @@ class MimeMagic
'application/x-blender' => [["blend", "blend", "blender"], []],
'application/x-bzdvi' => [["dvi.bz2"], []],
'application/x-bzip' => [["bz", "bz2"], []],
'application/x-bzip-compressed-tar' => [["tar.bz", "tar.bz2", "tbz", "tbz2"], []],
'application/x-bzip-compressed-tar' => [["tar.bz", "tar.bz2", "tbz", "tbz2"], ["application/x-bzip"]],
'application/x-bzpdf' => [["pdf.bz2"], []],
'application/x-bzpostscript' => [["ps.bz2"], []],
'application/x-cb7' => [["cb7"], ["application/x-7z-compressed"]],
'application/x-cbr' => [["cbr"], ["application/x-rar"]],
'application/x-cbt' => [["cbt"], ["application/x-tar"]],
'application/x-cbz' => [["cbz"], ["application/zip"]],
'application/x-cd-image' => [["iso", "iso9660"], []],
'application/x-cdrdao-toc' => [["toc"], ["text/plain"]],
......@@ -760,10 +840,12 @@ class MimeMagic
'application/x-dvi' => [["dvi"], []],
'application/x-e-theme' => [["etheme"], []],
'application/x-egon' => [["egon"], []],
'application/x-fictionbook+xml' => [["fb2"], ["application/xml"]],
'application/x-fluid' => [["fl"], ["text/plain"]],
'application/x-font-afm' => [["afm"], []],
'application/x-font-bdf' => [["bdf"], []],
'application/x-font-linux-psf' => [["psf"], []],
'application/x-font-otf' => [["otf"], []],
'application/x-font-pcf' => [["pcf", "pcf.gz", "pcf.z"], []],
'application/x-font-speedo' => [["spd"], []],
'application/x-font-ttf' => [["ttc", "ttf"], []],
......@@ -789,13 +871,20 @@ class MimeMagic
'application/x-hwp' => [["hwp"], []],
'application/x-hwt' => [["hwt"], []],
'application/x-ica' => [["ica"], ["text/plain"]],
'application/x-it87' => [["it87"], ["text/plain"]],
'application/x-java' => [["class"], []],
'application/x-java-archive' => [["jar"], []],
'application/x-java-jce-keystore' => [["jceks"], []],
'application/x-java-jnlp-file' => [["jnlp"], ["application/xml"]],
'application/x-java-keystore' => [["jks", "ks"], []],
'application/x-java-pack200' => [["pack"], []],
'application/x-jbuilder-project' => [["jpr", "jpx"], []],
'application/x-karbon' => [["karbon"], []],
'application/x-kchart' => [["chrt"], []],
'application/x-kexi-connectiondata' => [["kexic"], []],
'application/x-kexiproject-shortcut' => [["kexis"], []],
'application/x-kexiproject-sqlite2' => [["kexi"], ["application/x-sqlite2"]],
'application/x-kexiproject-sqlite3' => [["kexi"], ["application/x-sqlite3"]],
'application/x-kformula' => [["kfo"], []],
'application/x-killustrator' => [["kil"], []],
'application/x-kivio' => [["flw"], []],
......@@ -810,6 +899,7 @@ class MimeMagic
'application/x-lhz' => [["lhz"], []],
'application/x-linguist' => [["ts"], []],
'application/x-lyx' => [["lyx"], ["text/plain"]],
'application/x-lzip' => [["lz"], []],
'application/x-lzma' => [["lzma"], []],
'application/x-lzma-compressed-tar' => [["tar.lzma", "tlz"], []],
'application/x-lzop' => [["lzo"], []],
......@@ -835,7 +925,9 @@ class MimeMagic
'application/x-perl' => [["al", "perl", "pl", "pm"], ["application/x-executable", "text/plain"]],
'application/x-php' => [["php", "php3", "php4"], ["text/plain"]],
'application/x-pkcs12' => [["p12", "pfx"], []],
'application/x-pkcs7-certificates' => [["p7b", "spc"], []],
'application/x-planperfect' => [["pln"], []],
'application/x-pocket-word' => [["psw"], []],
'application/x-pw' => [["pw"], []],
'application/x-python-bytecode' => [["pyc", "pyo"], []],
'application/x-quattropro' => [["wb1", "wb2", "wb3"], []],
......@@ -856,6 +948,8 @@ class MimeMagic
'application/x-smaf' => [["mmf", "smaf"], []],
'application/x-sms-rom' => [["gg", "sms"], []],
'application/x-snes-rom' => [["smc"], []],
'application/x-spss-por' => [["por"], []],
'application/x-spss-sav' => [["sav"], []],
'application/x-stuffit' => [["sit"], []],
'application/x-subrip' => [["srt"], ["text/plain"]],
'application/x-sv4cpio' => [["sv4cpio"], []],
......@@ -873,32 +967,38 @@ class MimeMagic
'application/x-ufraw' => [["ufraw"], ["text/xml"]],
'application/x-ustar' => [["ustar"], []],
'application/x-wais-source' => [["src"], []],
'application/x-windows-themepack' => [["themepack"], ["application/vnd.ms-cab-compressed"]],
'application/x-wpg' => [["wpg"], []],
'application/x-x509-ca-cert' => [["cer", "cert", "crt", "der", "pem"], []],
'application/x-x509-ca-cert' => [["cert", "crt", "der", "pem"], []],
'application/x-xbel' => [["xbel"], ["application/xml"]],
'application/x-xliff' => [["xlf", "xliff"], ["application/xml"]],
'application/x-xz' => [["xz"], []],
'application/x-xz-compressed-tar' => [["tar.xz", "txz"], []],
'application/x-zoo' => [["zoo"], []],
'application/xhtml+xml' => [["xhtml"], ["application/xml"]],
'application/xml' => [["xbl", "xml", "xsl", "xslt"], ["text/plain"]],
'application/xml' => [["xbl", "xml"], ["text/plain"]],
'application/xml-dtd' => [["dtd"], ["text/plain"]],
'application/xml-external-parsed-entity' => [["ent"], ["application/xml"]],
'application/xslt+xml' => [["xsl", "xslt"], ["application/xml"]],
'application/xspf+xml' => [["xspf"], ["application/xml"]],
'application/zip' => [["zip"], []],
'audio/AMR' => [["amr"], []],
'audio/AMR-WB' => [["awb"], []],
'audio/ac3' => [["ac3"], []],
'audio/annodex' => [["axa"], ["application/annodex"]],
'audio/basic' => [["au", "snd"], []],
'audio/midi' => [["kar", "mid", "midi"], []],
'audio/mp2' => [["mp2"], []],
'audio/mp4' => [["aac", "m4a"], []],
'audio/mpeg' => [["mp3", "mpga"], []],
'audio/ogg' => [["oga"], ["application/ogg"]],
'audio/ogg' => [["oga", "ogg", "spx"], ["application/ogg"]],
'audio/prs.sid' => [["psid", "sid"], []],
'audio/vnd.rn-realaudio' => [["ra", "rax"], []],
'audio/x-aiff' => [["aif", "aifc", "aiff"], []],
'audio/x-ape' => [["ape"], []],
'audio/x-flac' => [["flac"], []],
'audio/x-flac+ogg' => [["ogg"], ["audio/ogg"]],
'audio/x-gsm' => [["gsm"], []],
'audio/x-iriver-pla' => [["pla"], []],
'audio/x-it' => [["it"], []],
'audio/x-m4b' => [["m4b"], ["audio/mp4"]],
......@@ -929,18 +1029,23 @@ class MimeMagic
'image/bmp' => [["bmp"], []],
'image/cgm' => [["cgm"], []],
'image/fax-g3' => [["g3"], []],
'image/fits' => [["fits"], []],
'image/gif' => [["gif"], []],
'image/ief' => [["ief"], []],
'image/jp2' => [["j2k", "jp2", "jpc", "jpf", "jpx"], []],
'image/jpeg' => [["jpe", "jpeg", "jpg"], []],
'image/openraster' => [["ora"], []],
'image/png' => [["png"], []],
'image/rle' => [["rle"], []],
'image/svg+xml' => [["svg"], ["application/xml"]],
'image/svg+xml-compressed' => [["svgz"], ["application/x-gzip"]],
'image/tiff' => [["tif", "tiff"], []],
'image/vnd.adobe.photoshop' => [["psd"], []],
'image/vnd.djvu' => [["djv", "djvu"], []],
'image/vnd.dwg' => [["dwg"], []],
'image/vnd.dxf' => [["dxf"], []],
'image/vnd.microsoft.icon' => [["ico"], []],
'image/vnd.ms-modi' => [["mdi"], []],
'image/vnd.rn-realpix' => [["rp"], []],
'image/vnd.wap.wbmp' => [["wbmp"], []],
'image/x-3ds' => [["3ds"], []],
......@@ -955,11 +1060,9 @@ class MimeMagic
'image/x-emf' => [["emf"], []],
'image/x-eps' => [["eps", "epsf", "epsi"], ["application/postscript"]],
'image/x-exr' => [["exr"], []],
'image/x-fits' => [["fits"], []],
'image/x-fuji-raf' => [["raf"], ["image/x-dcraw"]],
'image/x-gzeps' => [["eps.gz", "epsf.gz", "epsi.gz"], []],
'image/x-icns' => [["icns"], []],
'image/x-ico' => [["ico"], []],
'image/x-iff' => [["iff"], []],
'image/x-ilbm' => [["ilbm"], []],
'image/x-jng' => [["jng"], []],
......@@ -982,7 +1085,6 @@ class MimeMagic
'image/x-portable-bitmap' => [["pbm"], ["image/x-portable-anymap"]],
'image/x-portable-graymap' => [["pgm"], ["image/x-portable-anymap"]],
'image/x-portable-pixmap' => [["ppm"], ["image/x-portable-anymap"]],
'image/x-psd' => [["psd"], []],
'image/x-quicktime' => [["qif", "qtif"], []],
'image/x-rgb' => [["rgb"], []],
'image/x-sgi' => [["sgi"], []],
......@@ -1000,20 +1102,20 @@ class MimeMagic
'image/x-xfig' => [["fig"], []],
'image/x-xpixmap' => [["xpm"], []],
'image/x-xwindowdump' => [["xwd"], []],
'message/rfc822' => [["eml"], ["text/plain"]],
'model/vrml' => [["wrl"], ["text/plain"]],
'text/calendar' => [["ics", "vcs"], ["text/plain"]],
'text/css' => [["css", "cssl"], ["text/x-csrc"]],
'text/csv' => [["csv"], ["text/plain"]],
'text/directory' => [["gcrd", "vcf", "vct"], ["text/plain"]],
'text/html' => [["htm", "html"], ["text/plain"]],
'text/mathml' => [["mml"], ["application/xml"]],
'text/plain' => [["asc", "txt"], []],
'text/rdf' => [["owl", "rdf", "rdfs"], ["application/xml"]],
'text/richtext' => [["rtx"], ["text/plain"]],
'text/sgml' => [["sgm", "sgml"], ["text/plain"]],
'text/spreadsheet' => [["slk", "sylk"], ["text/plain"]],
'text/tab-separated-values' => [["tsv"], ["text/plain"]],
'text/troff' => [["roff", "t", "tr"], ["text/plain"]],
'text/vnd.graphviz' => [["dot", "gv"], []],
'text/vnd.rn-realtext' => [["rt"], []],
'text/vnd.sun.j2me.app-descriptor' => [["jad"], []],
'text/vnd.wap.wml' => [["wml"], ["application/xml"]],
......@@ -1028,7 +1130,7 @@ class MimeMagic
'text/x-csrc' => [["c"], ["text/plain"]],
'text/x-dcl' => [["dcl"], ["text/plain"]],
'text/x-dsl' => [["dsl"], ["text/plain"]],
'text/x-dsrc' => [["d"], ["text/plain"]],
'text/x-dsrc' => [["d"], ["text/x-csrc"]],
'text/x-eiffel' => [["e", "eif"], ["text/plain"]],
'text/x-emacs-lisp' => [["el"], ["text/plain"]],
'text/x-erlang' => [["erl"], ["text/plain"]],
......@@ -1077,11 +1179,12 @@ class MimeMagic
'text/x-txt2tags' => [["t2t"], ["text/plain"]],
'text/x-uil' => [["uil"], ["text/plain"]],
'text/x-uri' => [["uri", "url"], ["text/plain"]],
'text/x-vala' => [["vala"], ["text/x-csrc"]],
'text/x-vala' => [["vala", "vapi"], ["text/x-csrc"]],
'text/x-vhdl' => [["vhd", "vhdl"], ["text/plain"]],
'text/x-xmi' => [["xmi"], ["application/xml"]],
'text/x-xslfo' => [["fo", "xslfo"], ["application/xml"]],
'video/3gpp' => [["3g2", "3ga", "3gp", "3gpp"], ["video/mp4"]],
'video/annodex' => [["axv"], ["application/annodex"]],
'video/dv' => [["dv"], []],
'video/mp4' => [["m4v", "mp4"], []],
'video/mpeg' => [["m2t", "mp2", "mpe", "mpeg", "mpg", "vob"], []],
......@@ -1104,33 +1207,38 @@ class MimeMagic
}
MAGIC = [
['application/vnd.stardivision.writer', [[2089, "StarWriter"]]],
['image/x-eps', [[0, "%!", [[15, "EPS"]]], [0, "\x04%!", [[16, "EPS"]]]]],
['application/docbook+xml', [[0, "<?xml", [[0..100, "-//OASIS//DTD DocBook XML"], [0..100, "-//KDE//DTD DocBook XML"]]]]],
['application/x-java-archive', [[0, "PK\x03\x04", [[40, "\xFE\xCA"]]]]],
['application/smil', [[0..256, "<smil"]]],
['image/x-eps', [[0, "%!", [[15, "EPS"]]], [0, "\x04%!", [[16, "EPS"]]]]],
['image/svg+xml', [[0..256, "<!DOCTYPE svg"], [0..256, "<svg"]]],
['application/vnd.corel-draw', []],
['image/x-niff', [[0, "IIN1"]]],
['application/prs.plucker', [[60, "DataPlkr"]]],
['application/x-mozilla-bookmarks', [[0..64, "<!DOCTYPE NETSCAPE-Bookmark-file-1>"]]],
['image/svg+xml', [[0..256, "<!DOCTYPE svg"], [0..256, "<svg"]]],
['image/x-kodak-kdc', [[242, "EASTMAN KODAK COMPANY"]]],
['application/x-fictionbook+xml', [[0..256, "<FictionBook"]]],
['audio/x-vorbis+ogg', [[0, "OggS", [[28, "\x01vorbis"]]]]],
['application/vnd.corel-draw', []],
['application/x-php', [[0..64, "<?php"]]],
['image/x-kodak-kdc', [[242, "EASTMAN KODAK COMPANY"]]],
['application/x-xliff', [[0..256, "<xliff"]]],
['application/x-pak', [[0, "PACK"]]],
['audio/x-flac+ogg', [[0, "OggS", [[28, "fLaC"]]], [0, "OggS", [[28, "\x7FFLAC"]]]]],
['video/x-theora+ogg', [[0, "OggS", [[28, "\x80theora"]]]]],
['audio/x-speex+ogg', [[0, "OggS", [[28, "Speex "]]]]],
['application/x-php', [[0..64, "<?php"]]],
['video/x-ogm+ogg', [[0, "OggS", [[29, "video"]]]]],
['video/x-theora+ogg', [[0, "OggS", [[28, "\x80theora"]]]]],
['application/x-pak', [[0, "PACK"]]],
['application/prs.plucker', [[60, "DataPlkr"]]],
['application/rss+xml', [[0..256, "<rss "], [0..256, "<RSS "]]],
['text/x-opml+xml', [[0..256, "<opml "]]],
['application/vnd.apple.mpegurl', [[0..128, "#EXT-X-TARGETDURATION"]]],
['application/atom+xml', [[0..256, "<feed "]]],
['application/vnd.ms-wpl', [[0..256, "<?wpl"]]],
['text/x-txt2tags', [[0, "%!postproc"], [0, "%!encoding"]]],
['application/x-quicktime-media-link', [[0, "<?xml", [[0..64, "<?quicktime"]]], [0, "RTSPtext"], [0, "rtsptext"], [0, "SMILtext"]]],
['application/msword', [[0, "1\xBE\x00\x00"], [0, "PO^Q`"], [0, "\xFE7\x00#"], [0, "\xDB\xA5-\x00\x00\x00"], [2112, "MSWordDoc"], [2108, "MSWordDoc"], [2112, "Microsoft Word document data"], [546, "bjbj"], [546, "jbjb"]]],
['application/x-font-type1', [[0, "LWFN"], [65, "LWFN"], [0, "%!PS-AdobeFont-1."], [6, "%!PS-AdobeFont-1."], [0, "%!FontType1-1."], [6, "%!FontType1-1."]]],
['application/x-quicktime-media-link', [[0, "<?xml", [[0..64, "<?quicktime"]]], [0, "RTSPtext"], [0, "rtsptext"], [0, "SMILtext"]]],
['application/smil', [[0..256, "<smil"]]],
['audio/x-ms-asx', [[0, "ASF "], [0..64, "<ASX"], [0..64, "<asx"], [0..64, "<Asx"]]],
['audio/x-wav', [[8, "WAVE"], [8, "WAV "]]],
['image/x-icns', [[0, "icns"]]],
['application/gnunet-directory', [[0, "\x89GND\r\n\x1A\n"]]],
['application/x-t602', [[0, "@CT 0"], [0, "@CT 1"], [0, "@CT 2"]]],
['application/vnd.emusic-emusic_package', [[0, "nF7YLao"]]],
['video/x-sgi-movie', [[0, "MOVI"]]],
['application/sdp', [[0, "v=", [[0..256, "s="]]]]],
['video/x-nsv', [[0, "NSVf"]]],
......@@ -1139,8 +1247,6 @@ class MimeMagic
['video/x-ms-asf', [[0, "0&\xB2u"], [0, "[Reference]"]]],
['application/x-hwp', [[0, "HWP Document File"]]],
['video/x-flic', [[0, "\x11\xAF"], [0, "\x12\xAF"]]],
['image/x-quicktime', [[4, "idat"]]],
['video/quicktime', [[12, "mdat"], [4, "mdat"], [4, "moov"], [4, "ftypqt"]]],
['application/vnd.oasis.opendocument.text', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.text"]]]]]]],
['application/vnd.oasis.opendocument.text-template', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.text-template"]]]]]]],
['application/vnd.oasis.opendocument.text-web', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.text-web"]]]]]]],
......@@ -1152,17 +1258,23 @@ class MimeMagic
['application/vnd.oasis.opendocument.spreadsheet', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.spreadsheet"]]]]]]],
['application/vnd.oasis.opendocument.spreadsheet-template', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.spreadsheet-template"]]]]]]],
['application/vnd.oasis.opendocument.chart', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.chart"]]]]]]],
['application/vnd.oasis.opendocument.chart-template', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.chart-template"]]]]]]],
['application/vnd.oasis.opendocument.formula', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.formula"]]]]]]],
['application/vnd.oasis.opendocument.formula-template', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.formula-template"]]]]]]],
['application/vnd.oasis.opendocument.image', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.oasis.opendocument.image"]]]]]]],
['application/vnd.symbian.install', [[8, "\x19\x04\x00\x10"]]],
['x-epoc/x-sisx-app', [[0, "z\x1A \x10"]]],
['application/vnd.wordperfect', [[1, "WPC"]]],
['application/x-spss-por', [[40, "ASCII SPSS PORT FILE"]]],
['application/x-spss-sav', [[0, "$FL2"]]],
['application/x-xbel', [[0..256, "<!DOCTYPE xbel"]]],
['application/x-7z-compressed', [[0, "7z\xBC\xAF'\x1C"]]],
['application/x-abiword', [[0..256, "<abiword"], [0..256, "<!DOCTYPE abiword"]]],
['application/x-aportisdoc', [[60, "TEXtREAd"], [60, "TEXtTlDc"]]],
['application/x-applix-spreadsheet', [[0, "*BEGIN SPREADSHEETS"], [0, "*BEGIN", [[7, "SPREADSHEETS"]]]]],
['application/x-applix-word', [[0, "*BEGIN", [[7, "WORDS"]]]]],
['application/x-arc', []],
['video/mpeg', [[0, "G?\xFF\x10"], [0, "\x00\x00\x01\xB3"], [0, "\x00\x00\x01\xBA"]]],
['image/x-quicktime', [[4, "idat"]]],
['application/x-arj', [[0, "`\xEA"]]],
['application/x-awk', [[0, "#!/bin/gawk"], [0, "#! /bin/gawk"], [0, "#!/usr/bin/gawk"], [0, "#! /usr/bin/gawk"], [0, "#!/usr/local/bin/gawk"], [0, "#! /usr/local/bin/gawk"], [0, "#!/bin/awk"], [0, "#! /bin/awk"], [0, "#!/usr/bin/awk"], [0, "#! /usr/bin/awk"]]],
['application/x-bittorrent', [[0, "d8:announce"]]],
......@@ -1173,14 +1285,15 @@ class MimeMagic
['application/x-compress', [[0, "\x1F\x9D"]]],
['application/x-core', [[0, "\x7FELF", [[5, "\x01", [[16, "\x04\x00"]]]]], [0, "\x7FELF", [[5, "\x02", [[16, "\x00\x04"]]]]], [0, "Core\x01"], [0, "Core\x02"]]],
['application/x-cpio', [[0, "\xC7q"], [0, "070701"], [0, "070702"], [0, "q\xC7"]]],
['video/dv', []],
['video/quicktime', [[12, "mdat"], [4, "mdat"], [4, "moov"], [4, "ftypqt"]]],
['application/x-deb', [[0, "!<arch>", [[8, "debian"]]]]],
['application/x-desktop', [[0..32, "[Desktop Entry]"], [0, "[Desktop Action"], [0, "[KDE Desktop Entry]"], [0, "# Config File"], [0, "# KDE Config File"]]],
['application/vnd.ms-excel', [[2080, "Microsoft Excel 5.0 Worksheet"]]],
['application/x-dia-diagram', [[5..100, "<dia:"]]],
['application/x-dvi', [[0, "\xF7\x02"]]],
['text/xmcd', [[0, "# xmcd"]]],
['video/mpeg', [[0, "G?\xFF\x10"], [0, "\x00\x00\x01\xB3"], [0, "\x00\x00\x01\xBA"]]],
['application/x-fluid', [[0, "# data file for the Fltk"], [0, "version"], [0, "header_name"], [0, "code_name"]]],
['application/msword', [[0, "1\xBE\x00\x00"], [0, "PO^Q`"], [0, "\xFE7\x00#"], [0, "\xDB\xA5-\x00\x00\x00"], [2112, "MSWordDoc"], [2108, "MSWordDoc"], [2112, "Microsoft Word document data"]]],
['application/vnd.ms-cab-compressed', [[0, "MSCF\x00\x00\x00\x00"]]],
['application/x-font-bdf', [[0, "STARTFONT "]]],
['application/x-font-dos', [[0, "\xFFFON"], [7, "\x00EGA"], [7, "\x00VID"]]],
['application/x-font-framemaker', [[0, "<MakerScreenFont"]]],
......@@ -1203,15 +1316,16 @@ class MimeMagic
['application/x-gtktalog', [[4, "gtktalog "]]],
['application/x-gzip', [[0, "\x1F\x8B"]]],
['application/x-ipod-firmware', [[0, "S T O P"]]],
['application/vnd.ms-excel', [[2080, "Microsoft Excel 5.0 Worksheet"]]],
['application/x-java', [[0, "\xCA\xFE\xBA\xBE"]]],
['application/x-java-jnlp-file', [[0..256, "<jnlp"]]],
['application/x-java-keystore', [[0, "\xED\xFE\xED\xFE"]]],
['application/x-java-jce-keystore', [[0, "\xCE\xCE\xCE\xCE"]]],
['application/x-java-pack200', [[0, "\xCA\xFE\xD0\r"]]],
['application/x-karbon', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-karbon\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-karbon"]]]]]]],
['application/x-kchart', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-kchart\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-kchart"]]]]]]],
['application/x-kformula', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-kformula\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-kformula"]]]]]]],
['application/x-killustrator', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-killustrator\x04\x06"]]]]]]],
['text/x-ms-regedit', [[0, "REGEDIT"], [0, "Windows Registry Editor Version 5.00"], [0, "\xFF\xFEW\x00i\x00n\x00d\x00o\x00w\x00s\x00 \x00R\x00e\x00g\x00i\x00s\x00t\x00r\x00y\x00 \x00E\x00d\x00i\x00t\x00o\x00r\x00"]]],
['application/x-kivio', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-kivio\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-kivio"]]]]]]],
['application/x-kontour', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-kontour\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-kontour"]]]]]]],
['application/x-kpresenter', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-kpresenter\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-kpresenter"]]]]]]],
['application/x-krita', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-krita\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-krita"]]]]]]],
......@@ -1222,13 +1336,19 @@ class MimeMagic
['application/x-kword-crypt', [[0, "\r\x1A'\x01"]]],
['application/x-lha', [[2, "-lh -"], [2, "-lh0-"], [2, "-lh1-"], [2, "-lh2-"], [2, "-lh3-"], [2, "-lh4-"], [2, "-lh5-"], [2, "-lh40-"], [2, "-lhd-"], [2, "-lz4-"], [2, "-lz5-"], [2, "-lzs-"]]],
['application/x-lyx', [[0, "#LyX"]]],
['application/x-lzip', [[0, "LZIP"]]],
['application/x-lzop', [[0, "\x89LZO\x00\r\n\x1A\n"]]],
['application/x-macbinary', [[102, "mBIN"]]],
['application/x-matroska', [[8, "matroska"]]],
['application/mxf', [[0..256, "\x06\x0E+4\x02\x05\x01\x01\r\x01\x02\x01\x01\x02"]]],
['application/vnd.ms-access', [[0, "\x00\x01\x00\x00Standard Jet DB"]]],
['application/x-ms-dos-executable', [[0, "MZ"]]],
['application/x-mswinurl', [[1, "InternetShortcut"], [1, "DEFAULT", [[10, "BASEURL="]]]]],
['application/x-mswinurl', [[1, "InternetShortcut"], [1, "DEFAULT", [[11, "BASEURL="]]]]],
['application/x-nautilus-link', [[0..32, "<nautilus_object nautilus_link"]]],
['application/x-object', [[0, "\x7FELF", [[5, "\x01", [[16, "\x01\x00"]]]]], [0, "\x7FELF", [[5, "\x02", [[16, "\x00\x01"]]]]]]],
['application/annodex', [[0, "OggS", [[28, "fishead\x00", [[56..512, "CMML\x00\x00\x00\x00"]]]]]]],
['video/annodex', [[0, "OggS", [[28, "fishead\x00", [[56..512, "CMML\x00\x00\x00\x00"]]]]]]],
['audio/annodex', [[0, "OggS", [[28, "fishead\x00", [[56..512, "CMML\x00\x00\x00\x00"]]]]]]],
['application/ogg', [[0, "OggS"]]],
['audio/ogg', [[0, "OggS"]]],
['video/ogg', [[0, "OggS"]]],
......@@ -1237,22 +1357,22 @@ class MimeMagic
['video/x-flv', [[0, "FLV"]]],
['audio/x-speex', [[0, "Speex"]]],
['application/x-gedcom', [[0, "0 HEAD"]]],
['application/vnd.emusic-emusic_package', [[0, "nF7YLao"]]],
['application/x-cisco-vpn-settings', [[0, "[main]", [[0..256, "AuthType="]]]]],
['application/x-ole-storage', [[0, "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1"], [0, "\xD0\xCF\x11\xE0"]]],
['application/x-msi', [[0, "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00>\x00\x03\x00\xFE\xFF\t\x00\x06"]]],
['application/x-oleo', [[31, "Oleo"]]],
['application/x-t602', [[0, "@CT 0"], [0, "@CT 1"], [0, "@CT 2"]]],
['application/vnd.iccprofile', [[36, "acsp"]]],
['application/x-par2', [[0, "PAR2"]]],
['application/x-pef-executable', [[0, "Joy!"]]],
['application/x-perl', [[0, "eval \"exec /usr/local/bin/perl"], [1..16, "/bin/perl"], [1..16, "/bin/env perl"]]],
['application/rtf', [[0, "{\\rtf"]]],
['application/x-pocket-word', [[0, "{\\pwi"]]],
['application/x-python-bytecode', [[0, "\x99N\r\n"]]],
['application/epub+zip', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/epub+zip"]]]]]]],
['application/x-rar', [[0, "Rar!"]]],
['text/x-iptables', [[0..256, "/etc/sysconfig/iptables"], [0..256, "*filter", [[0..256, ":INPUT", [[0..256, ":FORWARD", [[0..256, ":OUTPUT"]]]]]]], [0..256, "-A INPUT", [[0..256, "-A FORWARD", [[0..256, "-A OUTPUT"]]]]], [0..256, "-P INPUT", [[0..256, "-P FORWARD", [[0..256, "-P OUTPUT"]]]]]]],
['video/dv', []],
['application/x-alz', [[0, "ALZ"]]],
['application/x-rpm', [[0, "\xED\xAB\xEE\xDB"]]],
['text/x-tex', [[1, "documentclass"]]],
['text/xmcd', [[0, "# xmcd"]]],
['application/x-sc', [[38, "Spreadsheet"]]],
['application/x-sharedlib', [[0, "\x7FELF", [[5, "\x01", [[16, "\x03\x00"]]]]], [0, "\x7FELF", [[5, "\x02", [[16, "\x00\x03"]]]]], [0, "\x83\x01"]]],
['application/x-shellscript', [[10, "# This is a shell archive"], [1..16, "/bin/bash"], [1..16, "/bin/nawk"], [1..16, "/bin/zsh"], [1..16, "/bin/sh"], [1..16, "/bin/ksh"], [0, "#!/usr/bin/env sh"], [0, "#!/usr/bin/env bash"], [0, "#!/usr/bin/env zsh"], [0, "#!/usr/bin/env ksh"]]],
......@@ -1273,35 +1393,39 @@ class MimeMagic
['application/x-tar', [[257, "ustar\x00"], [257, "ustar \x00"]]],
['application/x-tgif', [[0, "%TGIF"]]],
['text/troff', [[0, ".\\\""], [0, "'\\\""], [0, "'.\\\""], [0, "\\\""]]],
['application/x-xz', [[0, "\xFD7zXZ\x00"]]],
['application/x-zoo', [[20, "\xDC\xA7\xC4\xFD"]]],
['text/x-rpm-spec', [[0, "Summary: "], [0, "%define "]]],
['text/x-iptables', [[0..256, "/etc/sysconfig/iptables"], [0..256, "*filter", [[0..256, ":INPUT", [[0..256, ":FORWARD", [[0..256, ":OUTPUT"]]]]]]], [0..256, "-A INPUT", [[0..256, "-A FORWARD", [[0..256, "-A OUTPUT"]]]]], [0..256, "-P INPUT", [[0..256, "-P FORWARD", [[0..256, "-P OUTPUT"]]]]]]],
['audio/ac3', [[0, "\vw"]]],
['audio/AMR', [[0, "#!AMR\n"], [0, "#!AMR_MC1.0\n"]]],
['audio/AMR-WB', [[0, "#!AMR-WB\n"], [0, "#!AMR-WB_MC1.0\n"]]],
['text/x-lua', [[0, "/bin/lua"], [0, "/bin/env lua"]]],
['text/x-tex', [[1, "documentclass"]]],
['audio/prs.sid', [[0, "PSID"]]],
['audio/x-adpcm', [[0, ".snd", [[12, "\x00\x00\x00\x17"]]], [0, ".sd\x00", [[12, "\x01\x00\x00\x00"], [12, "\x02\x00\x00\x00"], [12, "\x03\x00\x00\x00"], [12, "\x04\x00\x00\x00"], [12, "\x05\x00\x00\x00"], [12, "\x06\x00\x00\x00"], [12, "\a\x00\x00\x00"], [12, "\x17\x00\x00\x00"]]]]],
['audio/x-aifc', [[8, "AIFC"]]],
['audio/x-aiff', [[8, "AIFF"], [8, "AIFC"], [8, "8SVX"]]],
['audio/x-ape', [[0, "MAC "]]],
['audio/x-it', [[0, "IMPM"]]],
['audio/x-flac', [[0, "fLaC"]]],
['audio/x-wavpack', [[0, "wvpk"]]],
['audio/x-wavpack-correction', [[0, "wvpk"]]],
['audio/midi', [[0, "MThd"]]],
['audio/x-mo3', [[0, "MO3"]]],
['audio/mp4', [[4, "ftypM4A"]]],
['video/mp4', [[4, "ftypisom"], [4, "ftypmp42"]]],
['video/mp4', [[4, "ftypisom"], [4, "ftypmp42"], [4, "ftypMSNV"], [4, "ftypM4V "]]],
['audio/x-m4b', [[4, "ftypM4B"]]],
['video/3gpp', [[4, "ftyp3gp"]]],
['audio/mpeg', [[0, "\x00\x00\xFF\xFB"], [0, "ID3"]]],
['audio/x-mpegurl', [[0, "#EXTM3U"]]],
['application/postscript', [[0, "\x04%!"], [0, "%!"]]],
['application/pgp-signature', [[0, "-----BEGIN PGP SIGNED MESSAGE-----"], [0, "-----BEGIN PGP SIGNATURE-----"]]],
['audio/x-psf', [[0, "PSF"]]],
['audio/x-musepack', [[0, "MP+"]]],
['text/x-python', [[0, "#!/bin/python"], [0, "#! /bin/python"], [0, "eval \"exec /bin/python"], [0, "#!/usr/bin/python"], [0, "#! /usr/bin/python"], [0, "eval \"exec /usr/bin/python"], [0, "#!/usr/local/bin/python"], [0, "#! /usr/local/bin/python"], [0, "eval \"exec /usr/local/bin/python"], [1..16, "/bin/env python"]]],
['application/vnd.rn-realmedia', [[0, ".RMF"]]],
['text/x-rpm-spec', [[0, "Summary: "], [0, "%define "]]],
['audio/x-s3m', [[44, "SCRM"]]],
['audio/x-scpls', [[0, "[playlist]"], [0, "[Playlist]"], [0, "[PLAYLIST]"]]],
['application/vnd.ms-tnef', [[0, "x\x9F>\""]]],
['audio/x-wav', [[8, "WAVE"], [8, "WAV "]]],
['audio/x-xi', [[0, "Extended Intrument:"]]],
['audio/x-xm', [[0, "Extended Module:"]]],
['audio/x-tta', [[0, "TTA1"]]],
......@@ -1309,83 +1433,89 @@ class MimeMagic
['image/gif', [[0, "GIF8"]]],
['image/jpeg', [[0, "\xFF\xD8\xFF"], [0, "\xFF\xD8"]]],
['image/jp2', [[4, "jP"], [0, "\xFFO\xFFQ\x00"], [3, "\fjP "]]],
['image/openraster', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "image/openraster"]]]]]]],
['image/x-dds', [[0, "DDS"]]],
['image/x-xcursor', [[0, "Xcur"]]],
['image/x-exr', [[0, "v/1\x01"]]],
['image/x-canon-crw', [[0, "II\x1A\x00\x00\x00HEAPCCDR"]]],
['image/x-fuji-raf', [[0, "FUJIFILMCCD-RAW "]]],
['application/pgp-signature', [[0, "-----BEGIN PGP SIGNED MESSAGE-----"], [0, "-----BEGIN PGP SIGNATURE-----"]]],
['application/pgp-keys', [[0, "-----BEGIN PGP PUBLIC KEY BLOCK-----"], [0, "-----BEGIN PGP PRIVATE KEY BLOCK-----"], [0, "\x95\x01"], [0, "\x95\x00"], [0, "\x99\x00"], [0, "\x99\x01"]]],
['image/x-minolta-mrw', [[0, "\x00MRM"]]],
['image/x-olympus-orf', [[0, "IIRO\b\x00\x00\x00"]]],
['image/x-panasonic-raw', [[0, "IIU\x00\b\x00\x00\x00"]]],
['image/x-sigma-x3f', [[0, "FOVb"]]],
['image/png', [[0, "\x89PNG"]]],
['application/pgp-keys', [[0, "-----BEGIN PGP PUBLIC KEY BLOCK-----"], [0, "-----BEGIN PGP PRIVATE KEY BLOCK-----"], [0, "\x95\x01"], [0, "\x95\x00"], [0, "\x99\x00"], [0, "\x99\x01"]]],
['application/pgp-encrypted', [[0, "-----BEGIN PGP MESSAGE-----"]]],
['image/tiff', [[0, "MM\x00*"], [0, "II*\x00"]]],
['image/vnd.dxf', [[0..64, "\nHEADER\n"], [0..64, "\r\nHEADER\r\n"]]],
['image/vnd.ms-modi', [[0, "EP*\x00"]]],
['image/x-applix-graphics', [[0, "*BEGIN", [[7, "GRAPHICS"]]]]],
['application/dicom', [[128, "DICM"]]],
['application/pgp-encrypted', [[0, "-----BEGIN PGP MESSAGE-----"]]],
['audio/x-iriver-pla', [[4, "iriver UMS PLA"]]],
['image/x-dib', [[0, "(\x00\x00\x00"]]],
['image/vnd.djvu', [[0, "AT&TFORM", [[12, "DJVM"], [12, "DJVU"]]], [0, "FORM", [[8, "DJVM"], [8, "DJVU"]]]]],
['image/dpx', [[0, "SDPX"]]],
['audio/x-iriver-pla', [[4, "iriver UMS PLA"]]],
['image/x-fits', [[0, "SIMPLE ="]]],
['image/x-fpx', [[0, "FPix"]]],
['image/x-ico', [[0, "\x00\x00\x01\x00", [[5, "\x00"]]]]],
['image/x-icns', [[0, "icns"]]],
['application/xspf+xml', [[0..64, "<playlist version=\"1"]]],
['image/fits', [[0, "SIMPLE ="]]],
['image/x-fpx', [[0, "FPix"]]],
['image/vnd.microsoft.icon', [[0, "\x00\x00\x01\x00", [[5, "\x00"]]]]],
['application/vnd.ms-tnef', [[0, "x\x9F>\""]]],
['application/pdf', [[0, "%PDF-"]]],
['image/x-pcx', [[0, "\n", [[1, "\x00"], [1, "\x02"], [1, "\x03"], [1, "\x05"]]]]],
['image/x-portable-bitmap', [[0, "P1", [[2, "\n", [[3, "#"]]]]], [0, "P4", [[2, "\n", [[3, "#"]]]]]]],
['image/x-portable-graymap', [[0, "P2", [[2, "\n", [[3, "#"]]]]], [0, "P5", [[2, "\n", [[3, "#"]]]]]]],
['image/x-portable-pixmap', [[0, "P3", [[2, "\n", [[3, "#"]]]]], [0, "P6", [[2, "\n", [[3, "#"]]]]]]],
['image/x-psd', []],
['image/vnd.adobe.photoshop', []],
['image/x-sun-raster', [[0, "Y\xA6j\x95"]]],
['text/x-patch', [[0, "diff\t"], [0, "diff "], [0, "***\t"], [0, "*** "], [0, "=== "], [0, "--- "], [0, "Only in\t"], [0, "Only in "], [0, "Common subdirectories: "], [0, "Index:"]]],
['text/x-lua', [[0, "/bin/lua"], [0, "/bin/env lua"]]],
['image/x-win-bitmap', [[0, "\x00\x00\x02\x00", [[5, "\x00"]]]]],
['application/x-navi-animation', [[0, "RIFF", [[8, "ACON"]]]]],
['image/x-emf', [[0, "\x01\x00\x00\x00", [[40, " EMF", [[44, "\x00\x00\x01\x00", [[58, "\x00\x00"]]]]]]]]],
['image/x-wmf', [[0, "\xD7\xCD\xC6\x9A", [[22, "\x01\x00", [[24, "\t\x00"]]]]], [0, "\x01\x00", [[2, "\t\x00"]]]]],
['image/x-xcf', [[0, "gimp xcf file"]]],
['image/x-xfig', [[0, "#FIG"]]],
['image/x-xpixmap', [[0, "/* XPM"]]],
['message/news', [[0, "Article"], [0, "Path:"], [0, "Xref:"]]],
['message/rfc822', [[0, "#! rnews"], [0, "Forward to"], [0, "From:"], [0, "N#! rnews"], [0, "Pipe to"], [0, "Received:"], [0, "Relay-Version:"], [0, "Return-Path:"], [0, "Return-path:"], [0, "Subject: "]]],
['text/calendar', [[0, "BEGIN:VCALENDAR"], [0, "begin:vcalendar"]]],
['text/directory', [[0, "BEGIN:VCARD"], [0, "begin:vcard"]]],
['application/pdf', [[0, "%PDF-"]]],
['text/x-matlab', [[0, "function"]]],
['application/metalink+xml', [[0..256, "<metalink"]]],
['text/x-python', [[0, "#!/bin/python"], [0, "#! /bin/python"], [0, "eval \"exec /bin/python"], [0, "#!/usr/bin/python"], [0, "#! /usr/bin/python"], [0, "eval \"exec /usr/bin/python"], [0, "#!/usr/local/bin/python"], [0, "#! /usr/local/bin/python"], [0, "eval \"exec /usr/local/bin/python"], [1..16, "/bin/env python"]]],
['text/plain', [[0, "This is TeX,"], [0, "This is METAFONT,"]]],
['application/x-cisco-vpn-settings', [[0, "[main]"]]],
['application/x-it87', [[0, "IT8.7"]]],
['application/mathematica', [[0, "(************** Content-type: application/mathematica"], [100..256, "This notebook can be used on any computer system with Mathematica"], [10..256, "This is a Mathematica Notebook file. It contains ASCII text"]]],
['application/mac-binhex40', [[11, "must be converted with BinHex"]]],
['text/spreadsheet', [[0, "ID;"]]],
['text/x-matlab', [[0, "function"]]],
['text/vnd.sun.j2me.app-descriptor', [[0, "MIDlet-"]]],
['application/x-ace', [[7, "**ACE**"]]],
['text/x-mup', [[0, "//!Mup"]]],
['text/x-patch', [[0, "diff\t"], [0, "diff "], [0, "***\t"], [0, "*** "], [0, "=== "], [0, "--- "], [0, "Only in\t"], [0, "Only in "], [0, "Common subdirectories: "], [0, "Index:"]]],
['text/x-emacs-lisp', [[0, "\n("], [0, ";ELC\x13\x00\x00\x00"]]],
['text/html', [[0..256, "<!DOCTYPE HTML"], [0..256, "<!doctype html"], [0..256, "<HEAD"], [0..256, "<head"], [0..256, "<TITLE"], [0..256, "<title"], [0..256, "<HTML"], [0..256, "<html"], [0..256, "<SCRIPT"], [0..256, "<script"], [0, "<BODY"], [0, "<body"], [0, "<!--"], [0, "<h1"], [0, "<H1"], [0, "<!doctype HTML"], [0, "<!DOCTYPE html"]]],
['text/x-google-video-pointer', [[0, "#.download.the.free.Google.Video.Player"], [0, "# download the free Google Video Player"]]],
['text/x-ldif', [[0, "dn: cn="], [0, "dn: mail="]]],
['text/x-makefile', [[0, "#!/usr/bin/make"], [0, "#! /usr/bin/make"]]],
['application/x-kivio', [[0, "\x1F\x8B", [[10, "KOffice", [[18, "application/x-kivio\x04\x06"]]]]], [0, "PK\x03\x04", [[30, "mimetype", [[38, "application/x-kivio"]]]]]]],
['text/x-ms-regedit', [[0, "REGEDIT"], [0, "Windows Registry Editor Version 5.00"], [0, "\xFF\xFEW\x00i\x00n\x00d\x00o\x00w\x00s\x00 \x00R\x00e\x00g\x00i\x00s\x00t\x00r\x00y\x00 \x00E\x00d\x00i\x00t\x00o\x00r\x00"]]],
['text/x-mup', [[0, "//!Mup"]]],
['text/vnd.graphviz', [[0, "digraph "], [0, "strict digraph "], [0, "graph "], [0, "strict graph "]]],
['application/x-archive', [[0, "<ar>"], [0, "!<arch>"]]],
['audio/x-riff', [[0, "RIFF"]]],
['application/x-executable', [[0, "\x7FELF", [[5, "\x01", [[16, "\x02\x00"]]]]], [0, "\x7FELF", [[5, "\x02", [[16, "\x00\x02"]]]]], [0, "MZ"], [0, "\x1CR"], [0, "\x10\x01"], [0, "\x11\x01"], [0, "\x83\x01"]]],
['application/xml', [[0, "<?xml"], [0, "<!--"]]],
['audio/basic', [[0, ".snd"]]],
['application/zip', [[0, "PK\x03\x04"]]],
['text/x-csrc', [[0, "/*"], [0, "//"], [0, "#include"]]],
['audio/basic', [[0, ".snd"]]],
['application/x-executable', [[0, "\x7FELF", [[5, "\x01", [[16, "\x02\x00"]]]]], [0, "\x7FELF", [[5, "\x02", [[16, "\x00\x02"]]]]], [0, "MZ"], [0, "\x1CR"], [0, "\x10\x01"], [0, "\x11\x01"], [0, "\x83\x01"]]],
['text/x-objcsrc', [[0, "#import"]]],
['text/x-csrc', [[0, "/*"], [0, "//"], [0, "#include"]]],
['text/x-vhdl', [[0, "--"]]],
['application/mbox', [[0, "From "]]],
['text/x-matlab', [[0, "%"]]],
['text/x-tex', [[0, "%"]]],
['image/x-tga', [[1, "\x01\x01"], [1, "\x019"], [1, "\x00\x03"], [1, "\x00\n"], [1, "\x00\v"], [1, "\x00\x02"]]],
['text/x-tex', [[0, "%"]]],
['application/vnd.sun.xml.impress.template', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.impress"]]]]]]],
['application/x-ruby', [[1..16, "/bin/env ruby"], [1..16, "/bin/ruby"]]],
['application/x-dar', [[0, "\x00\x00\x00{"]]],
['application/vnd.sun.xml.writer.template', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.writer"]]]]]]],
['application/vnd.sun.xml.writer.global', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.writer"]]]]]]],
['application/x-dar', [[0, "\x00\x00\x00{"]]],
['application/vnd.sun.xml.writer', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.writer"]]]]]]],
['application/vnd.sun.xml.math', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.math"]]]]]]],
['application/x-csh', [[1..16, "/bin/tcsh"], [1..16, "/bin/csh"], [0, "#!/usr/bin/env csh"], [0, "#!/usr/bin/env tcsh"]]],
['application/vnd.sun.xml.impress', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.impress"]]]]]]],
......@@ -1395,6 +1525,6 @@ class MimeMagic
['application/vnd.sun.xml.calc', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.calc"]]]]]]],
['application/x-sqlite3', [[0, "SQLite format 3"]]],
['application/x-sqlite2', [[0, "** This file contains an SQLite"]]],
['application/vnd.sun.xml.writer', [[0, "PK\x03\x04", [[30, "mimetype", [[38, "application/vnd.sun.xml.writer"]]]]]]],
['application/x-ruby', [[1..16, "/bin/env ruby"], [1..16, "/bin/ruby"]]],
]
end
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -48,7 +48,12 @@ def get_matches(parent)
}.compact
end
FILE = ARGV[0] || '/usr/share/mime/packages/freedesktop.org.xml'
if ARGV.size != 1
puts "Usage: #{$0} <freedesktop.org.xml>"
exit 1
end
FILE = ARGV[0]
file = File.new(FILE)
doc = REXML::Document.new(file)
extensions = {}
......
gem 'test-unit', '>= 0'
gem 'test-spec', '>= 0'
gem 'bacon', '>= 0'
require 'test/unit'
require 'test/spec'
require 'bacon'
require 'mimemagic'
describe 'MimeMagic' do
it 'should have text? helper' do
it 'should have mediatype helpers' do
MimeMagic.new('text/plain').should.be.text
MimeMagic.new('text/html').should.be.text
MimeMagic.new('application/octet-stream').should.be.not.text
MimeMagic.new('image/png').should.be.not.text
MimeMagic.new('application/octet-stream').should.not.be.text
MimeMagic.new('image/png').should.not.be.text
MimeMagic.new('image/png').should.be.image
MimeMagic.new('video/ogg').should.be.video
MimeMagic.new('audio/mpeg').should.be.audio
end
it 'should have hierarchy' do
MimeMagic.new('text/html').should.be.child_of 'text/plain'
MimeMagic.new('text/x-java').should.be.child_of 'text/plain'
end
it 'should have extensions' do
MimeMagic.new('text/html').extensions.should == %w(htm html)
MimeMagic.new('text/html').extensions.should.equal %w(htm html)
end
it 'should recognize extensions' do
MimeMagic.by_extension('html').to_s.should == 'text/html'
MimeMagic.by_extension('rb').to_s.should == 'application/x-ruby'
MimeMagic.by_extension('crazy').should == nil
MimeMagic.by_extension('').should == nil
MimeMagic.by_extension('html').to_s.should.equal 'text/html'
MimeMagic.by_extension('rb').to_s.should.equal 'application/x-ruby'
MimeMagic.by_extension('crazy').should.equal nil
MimeMagic.by_extension('').should.equal nil
end
it 'should recognize by magic' do
Dir['test/files/*'].each do |file|
mime = file[11..-1].gsub('.', '/')
MimeMagic.by_magic(File.read(file)).to_s.should == mime
MimeMagic.by_magic(File.open(file, 'rb')).to_s.should == mime
MimeMagic.by_magic(File.read(file)).to_s.should.equal mime
MimeMagic.by_magic(File.open(file, 'rb')).to_s.should.equal mime
end
end
it 'should have add' do
MimeMagic.add('application/mimemagic-test', %w(ext1 ext2), %w(application/xml))
MimeMagic.by_extension('ext1').to_s.should.equal 'application/mimemagic-test'
MimeMagic.by_extension('ext2').to_s.should.equal 'application/mimemagic-test'
MimeMagic.new('application/mimemagic-test').extensions.should.equal %w(ext1 ext2)
MimeMagic.new('application/mimemagic-test').should.be.child_of 'text/plain'
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment