Update MimeTypes.cs

pull/3050/head
artiume 4 years ago committed by GitHub
parent 491f59cad4
commit 675cbd8a16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -17,115 +17,134 @@ namespace MediaBrowser.Model.Net
/// </summary>
private static readonly HashSet<string> _videoFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
".mkv",
".m2t",
".m2ts",
".3gp",
".asf",
".avi",
".divx",
".dvr-ms",
".f4v",
".flv",
".img",
".iso",
".m2t",
".m2ts",
".m2v",
".m4v",
".mk3d",
".ts",
".rmvb",
".mkv",
".mov",
".avi",
".mp4",
".mpg",
".mpeg",
".wmv",
".mp4",
".divx",
".dvr-ms",
".wtv",
".mts",
".ogg",
".ogm",
".ogv",
".asf",
".m4v",
".flv",
".f4v",
".3gp",
".webm",
".mts",
".m2v",
".rec"
".ts",
".rmvb",
".webm",
".wmv",
".wtv",
};
// http://en.wikipedia.org/wiki/Internet_media_type
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
// http://www.iana.org/assignments/media-types/media-types.xhtml
// Add more as needed
private static readonly Dictionary<string, string> _mimeTypeLookup = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
// Type application
{ ".7z", "application/x-7z-compressed" },
{ ".azw", "application/vnd.amazon.ebook" },
{ ".cbz", "application/x-cbz" },
{ ".cbr", "application/epub+zip" },
{ ".eot", "application/vnd.ms-fontobject" },
{ ".epub", "application/epub+zip" },
{ ".js", "application/x-javascript" },
{ ".json", "application/json" },
{ ".m3u8", "application/x-mpegURL" },
{ ".map", "application/x-javascript" },
{ ".mobi", "application/x-mobipocket-ebook" },
{ ".pdf", "application/pdf" },
{ ".rar", "application/vnd.rar" },
{ ".srt", "application/x-subrip" },
{ ".ttml", "application/ttml+xml" },
{ ".m3u8", "application/x-mpegURL" },
{ ".mobi", "application/x-mobipocket-ebook" },
{ ".xml", "application/xml" },
{ ".wasm", "application/wasm" },
{ ".xml", "application/xml" },
{ ".zip", "application/zip" },
// Type image
{ ".bmp", "image/bmp" },
{ ".gif", "image/gif" },
{ ".ico", "image/vnd.microsoft.icon" },
{ ".jpg", "image/jpeg" },
{ ".jpeg", "image/jpeg" },
{ ".tbn", "image/jpeg" },
{ ".png", "image/png" },
{ ".gif", "image/gif" },
{ ".tiff", "image/tiff" },
{ ".webp", "image/webp" },
{ ".ico", "image/vnd.microsoft.icon" },
{ ".svg", "image/svg+xml" },
{ ".svgz", "image/svg+xml" },
{ ".tbn", "image/jpeg" },
{ ".tif", "image/tiff" },
{ ".tiff", "image/tiff" },
{ ".webp", "image/webp" },
// Type font
{ ".ttf" , "font/ttf" },
{ ".woff" , "font/woff" },
{ ".woff2" , "font/woff2" },
// Type text
{ ".ass", "text/x-ssa" },
{ ".ssa", "text/x-ssa" },
{ ".css", "text/css" },
{ ".csv", "text/csv" },
{ ".rtf", "text/rtf" },
{ ".txt", "text/plain" },
{ ".vtt", "text/vtt" },
// Type video
{ ".mpg", "video/mpeg" },
{ ".ogv", "video/ogg" },
{ ".mov", "video/quicktime" },
{ ".webm", "video/webm" },
{ ".mkv", "video/x-matroska" },
{ ".wmv", "video/x-ms-wmv" },
{ ".flv", "video/x-flv" },
{ ".avi", "video/x-msvideo" },
{ ".asf", "video/x-ms-asf" },
{ ".m4v", "video/x-m4v" },
{ ".m4s", "video/mp4" },
{ ".3gp", "video/3gpp" },
{ ".3g2", "video/3gpp2" },
{ ".asf", "video/x-ms-asf" },
{ ".avi", "video/x-msvideo" },
{ ".flv", "video/x-flv" },
{ ".mp4", "video/mp4" },
{ ".m4s", "video/mp4" },
{ ".m4v", "video/x-m4v" },
{ ".mpegts", "video/mp2t" },
{ ".mpg", "video/mpeg" },
{ ".mkv", "video/x-matroska" },
{ ".mov", "video/quicktime" },
{ ".mpd", "video/vnd.mpeg.dash.mpd" },
{ ".ogg", "video/ogg" },
{ ".ogv", "video/ogg" },
{ ".ts", "video/mp2t" },
{ ".mpegts", "video/mp2t" },
{ ".webm", "video/webm" },
{ ".wmv", "video/x-ms-wmv" },
// Type audio
{ ".mp3", "audio/mpeg" },
{ ".m4a", "audio/mp4" },
{ ".aac", "audio/mp4" },
{ ".webma", "audio/webm" },
{ ".wav", "audio/wav" },
{ ".wma", "audio/x-ms-wma" },
{ ".ogg", "audio/ogg" },
{ ".oga", "audio/ogg" },
{ ".opus", "audio/ogg" },
{ ".ac3", "audio/ac3" },
{ ".ape", "audio/x-ape" },
{ ".dsf", "audio/dsf" },
{ ".m4b", "audio/m4b" },
{ ".xsp", "audio/xsp" },
{ ".dsp", "audio/dsp" },
{ ".flac", "audio/flac" },
{ ".ape", "audio/x-ape" },
{ ".m4a", "audio/mp4" },
{ ".m4b", "audio/m4b" },
{ ".mid", "audio/midi" },
{ ".midi", "audio/midi" },
// There's also audio/x-midi
{ ".mp3", "audio/mpeg" },
{ ".oga", "audio/ogg" },
{ ".ogg", "audio/ogg" },
{ ".opus", "audio/ogg" },
{ ".vorbis", "audio/vorbis" },
{ ".wav", "audio/wav" },
{ ".webma", "audio/webm" },
{ ".wma", "audio/x-ms-wma" },
{ ".wv", "audio/x-wavpack" },
{ ".xsp", "audio/xsp" },
};
private static readonly Dictionary<string, string> _extensionLookup = CreateExtensionLookup();
@ -157,6 +176,7 @@ namespace MediaBrowser.Model.Net
}
var ext = Path.GetExtension(path);
var beg = Path.GetFullPath(path);
if (_mimeTypeLookup.TryGetValue(ext, out string result))
{
@ -184,6 +204,7 @@ namespace MediaBrowser.Model.Net
// Misc
if (string.Equals(ext, ".dll", StringComparison.OrdinalIgnoreCase))
|| string.Equals(beg, "._*", StringComparison.OrdinalIgnoreCase))
{
return "application/octet-stream";
}

Loading…
Cancel
Save