updates and fixes in mime types

This commit is contained in:
InsanusMokrassar 2022-12-02 21:01:11 +06:00
parent a812c2dd2f
commit f9a8c39879
8 changed files with 1524 additions and 1483 deletions

View File

@ -13,6 +13,10 @@
* `Ktor`: * `Ktor`:
* `Client`: * `Client`:
* `KtorReadCRUDRepoClient` now requires `paginationIdType` * `KtorReadCRUDRepoClient` now requires `paginationIdType`
* `LanguageCodes`:
* Updates and fixes in generation
* `MimeTypes`:
* Updates and fixes in generation
## 0.14.4 ## 0.14.4

View File

@ -17,10 +17,11 @@ def fix_name(category, raw_name):
result += out1 result += out1
return result return result
# https://www.freeformatter.com/mime-types-list.html
if __name__ == '__main__': if __name__ == '__main__':
df = pd.read_html(open('table.html', 'r')) df = pd.read_html(open('table.html', 'r'))
mimes = [] mimes = []
for row in df[0].iterrows(): for row in df[0].drop_duplicates(subset=['MIME Type / Internet Media Type'], keep='first').iterrows():
mime = row[1][1] mime = row[1][1]
mime_category = mime.split('/', 1)[0] mime_category = mime.split('/', 1)[0]
mime_name = mime.split('/', 1)[1] mime_name = mime.split('/', 1)[1]
@ -37,7 +38,7 @@ if __name__ == '__main__':
code2 = 'internal val knownMimeTypes: Set<MimeType> = setOf(\n' code2 = 'internal val knownMimeTypes: Set<MimeType> = setOf(\n'
code2 += ' KnownMimeTypes.Any,\n' code2 += ' KnownMimeTypes.Any,\n'
for key, group in grouped: for key, group in grouped:
group_name = key.capitalize() group_name = fix_name(group, key)
code += '@Serializable(MimeTypeSerializer::class)\nsealed class %s(raw: String) : MimeType, KnownMimeTypes(raw) {\n' % group_name code += '@Serializable(MimeTypeSerializer::class)\nsealed class %s(raw: String) : MimeType, KnownMimeTypes(raw) {\n' % group_name
code += ' @Serializable(MimeTypeSerializer::class)\n object Any: %s ("%s/*")\n' % (group_name, key) code += ' @Serializable(MimeTypeSerializer::class)\n object Any: %s ("%s/*")\n' % (group_name, key)
for mime in group: for mime in group:

View File

@ -0,0 +1,3 @@
package dev.inmo.micro_utils.mime_types
data class CustomMimeType(override val raw: String) : MimeType

View File

@ -0,0 +1,705 @@
package dev.inmo.micro_utils.mime_types
internal val knownMimeTypes: Set<MimeType> = setOf(
KnownMimeTypes.Any,
KnownMimeTypes.Application.VndHzn3dCrossword,
KnownMimeTypes.Application.VndMseq,
KnownMimeTypes.Application.Vnd3mPostItNotes,
KnownMimeTypes.Application.Vnd3gppPicBwLarge,
KnownMimeTypes.Application.Vnd3gppPicBwSmall,
KnownMimeTypes.Application.Vnd3gppPicBwVar,
KnownMimeTypes.Application.Vnd3gpp2Tcap,
KnownMimeTypes.Application.X7zCompressed,
KnownMimeTypes.Application.XAbiword,
KnownMimeTypes.Application.XAceCompressed,
KnownMimeTypes.Application.VndAmericandynamicsAcc,
KnownMimeTypes.Application.VndAcucobol,
KnownMimeTypes.Application.VndAcucorp,
KnownMimeTypes.Application.XAuthorwareBin,
KnownMimeTypes.Application.XAuthorwareMap,
KnownMimeTypes.Application.XAuthorwareSeg,
KnownMimeTypes.Application.VndAdobeAirApplicationInstallerPackageZip,
KnownMimeTypes.Application.XShockwaveFlash,
KnownMimeTypes.Application.VndAdobeFxp,
KnownMimeTypes.Application.Pdf,
KnownMimeTypes.Application.VndCupsPpd,
KnownMimeTypes.Application.XDirector,
KnownMimeTypes.Application.VndAdobeXdpXml,
KnownMimeTypes.Application.VndAdobeXfdf,
KnownMimeTypes.Application.VndAheadSpace,
KnownMimeTypes.Application.VndAirzipFilesecureAzf,
KnownMimeTypes.Application.VndAirzipFilesecureAzs,
KnownMimeTypes.Application.VndAmazonEbook,
KnownMimeTypes.Application.VndAmigaAmi,
KnownMimeTypes.Application.AndrewInset,
KnownMimeTypes.Application.VndAndroidPackageArchive,
KnownMimeTypes.Application.VndAnserWebCertificateIssueInitiation,
KnownMimeTypes.Application.VndAnserWebFundsTransferInitiation,
KnownMimeTypes.Application.VndAntixGameComponent,
KnownMimeTypes.Application.XAppleDiskimage,
KnownMimeTypes.Application.VndAppleInstallerXml,
KnownMimeTypes.Application.Applixware,
KnownMimeTypes.Application.VndHheLessonPlayer,
KnownMimeTypes.Application.XFreearc,
KnownMimeTypes.Application.VndAristanetworksSwi,
KnownMimeTypes.Application.AtomcatXml,
KnownMimeTypes.Application.AtomsvcXml,
KnownMimeTypes.Application.AtomXml,
KnownMimeTypes.Application.PkixAttrCert,
KnownMimeTypes.Application.VndAudiograph,
KnownMimeTypes.Application.XBcpio,
KnownMimeTypes.Application.OctetStream,
KnownMimeTypes.Application.XBittorrent,
KnownMimeTypes.Application.VndRimCod,
KnownMimeTypes.Application.VndBlueiceMultipass,
KnownMimeTypes.Application.VndBmi,
KnownMimeTypes.Application.XSh,
KnownMimeTypes.Application.VndBusinessobjects,
KnownMimeTypes.Application.XBzip,
KnownMimeTypes.Application.XBzip2,
KnownMimeTypes.Application.XCsh,
KnownMimeTypes.Application.VndChemdrawXml,
KnownMimeTypes.Application.XCdf,
KnownMimeTypes.Application.VndContactCmsg,
KnownMimeTypes.Application.VndClaymore,
KnownMimeTypes.Application.VndClonkC4group,
KnownMimeTypes.Application.CdmiCapability,
KnownMimeTypes.Application.CdmiContainer,
KnownMimeTypes.Application.CdmiDomain,
KnownMimeTypes.Application.CdmiObject,
KnownMimeTypes.Application.CdmiQueue,
KnownMimeTypes.Application.VndCluetrustCartomobileConfig,
KnownMimeTypes.Application.VndCluetrustCartomobileConfigPkg,
KnownMimeTypes.Application.MacCompactpro,
KnownMimeTypes.Application.VndWapWmlc,
KnownMimeTypes.Application.VndXara,
KnownMimeTypes.Application.VndCosmocaller,
KnownMimeTypes.Application.XCpio,
KnownMimeTypes.Application.VndCrickClicker,
KnownMimeTypes.Application.VndCrickClickerKeyboard,
KnownMimeTypes.Application.VndCrickClickerPalette,
KnownMimeTypes.Application.VndCrickClickerTemplate,
KnownMimeTypes.Application.VndCrickClickerWordbank,
KnownMimeTypes.Application.VndCriticaltoolsWbsXml,
KnownMimeTypes.Application.VndRigCryptonote,
KnownMimeTypes.Application.CuSeeme,
KnownMimeTypes.Application.PrsCww,
KnownMimeTypes.Application.VndCurlCar,
KnownMimeTypes.Application.VndCurlPcurl,
KnownMimeTypes.Application.VndYellowriverCustomMenu,
KnownMimeTypes.Application.DsscDer,
KnownMimeTypes.Application.DsscXml,
KnownMimeTypes.Application.XDebianPackage,
KnownMimeTypes.Application.XDvi,
KnownMimeTypes.Application.VndFdsnSeed,
KnownMimeTypes.Application.XDtbookXml,
KnownMimeTypes.Application.XDtbresourceXml,
KnownMimeTypes.Application.VndDvbAit,
KnownMimeTypes.Application.VndDvbService,
KnownMimeTypes.Application.XmlDtd,
KnownMimeTypes.Application.VndDolbyMlp,
KnownMimeTypes.Application.XDoom,
KnownMimeTypes.Application.VndDpgraph,
KnownMimeTypes.Application.VndDreamfactory,
KnownMimeTypes.Application.VndDynageo,
KnownMimeTypes.Application.Ecmascript,
KnownMimeTypes.Application.VndEcowinChart,
KnownMimeTypes.Application.Exi,
KnownMimeTypes.Application.VndProteusMagazine,
KnownMimeTypes.Application.EpubZip,
KnownMimeTypes.Application.VndEnliven,
KnownMimeTypes.Application.VndIsXpr,
KnownMimeTypes.Application.VndXfdl,
KnownMimeTypes.Application.EmmaXml,
KnownMimeTypes.Application.VndEzpixAlbum,
KnownMimeTypes.Application.VndEzpixPackage,
KnownMimeTypes.Application.VndDenovoFcselayoutLink,
KnownMimeTypes.Application.VndFluxtimeClip,
KnownMimeTypes.Application.VndFdf,
KnownMimeTypes.Application.VndMif,
KnownMimeTypes.Application.VndFramemaker,
KnownMimeTypes.Application.VndFscWeblaunch,
KnownMimeTypes.Application.VndFrogansFnc,
KnownMimeTypes.Application.VndFrogansLtf,
KnownMimeTypes.Application.VndFujixeroxDdd,
KnownMimeTypes.Application.VndFujixeroxDocuworks,
KnownMimeTypes.Application.VndFujixeroxDocuworksBinder,
KnownMimeTypes.Application.VndFujitsuOasys,
KnownMimeTypes.Application.VndFujitsuOasys2,
KnownMimeTypes.Application.VndFujitsuOasys3,
KnownMimeTypes.Application.VndFujitsuOasysgp,
KnownMimeTypes.Application.VndFujitsuOasysprs,
KnownMimeTypes.Application.XFuturesplash,
KnownMimeTypes.Application.VndFuzzysheet,
KnownMimeTypes.Application.VndGmx,
KnownMimeTypes.Application.VndGenomatixTuxedo,
KnownMimeTypes.Application.VndGeogebraFile,
KnownMimeTypes.Application.VndGeogebraTool,
KnownMimeTypes.Application.VndGeometryExplorer,
KnownMimeTypes.Application.VndGeonext,
KnownMimeTypes.Application.VndGeoplan,
KnownMimeTypes.Application.VndGeospace,
KnownMimeTypes.Application.XFontGhostscript,
KnownMimeTypes.Application.XFontBdf,
KnownMimeTypes.Application.XGtar,
KnownMimeTypes.Application.XTexinfo,
KnownMimeTypes.Application.XGnumeric,
KnownMimeTypes.Application.VndGoogleEarthKmlXml,
KnownMimeTypes.Application.VndGoogleEarthKmz,
KnownMimeTypes.Application.GpxXml,
KnownMimeTypes.Application.VndGrafeq,
KnownMimeTypes.Application.VndGrooveAccount,
KnownMimeTypes.Application.VndGrooveHelp,
KnownMimeTypes.Application.VndGrooveIdentityMessage,
KnownMimeTypes.Application.VndGrooveInjector,
KnownMimeTypes.Application.VndGrooveToolMessage,
KnownMimeTypes.Application.VndGrooveToolTemplate,
KnownMimeTypes.Application.VndGrooveVcard,
KnownMimeTypes.Application.Gzip,
KnownMimeTypes.Application.VndHpHpid,
KnownMimeTypes.Application.VndHpHps,
KnownMimeTypes.Application.XHdf,
KnownMimeTypes.Application.VndHbci,
KnownMimeTypes.Application.VndHpJlyt,
KnownMimeTypes.Application.VndHpPcl,
KnownMimeTypes.Application.VndHpHpgl,
KnownMimeTypes.Application.VndYamahaHvScript,
KnownMimeTypes.Application.VndYamahaHvDic,
KnownMimeTypes.Application.VndYamahaHvVoice,
KnownMimeTypes.Application.VndHydrostatixSofData,
KnownMimeTypes.Application.Hyperstudio,
KnownMimeTypes.Application.VndHalXml,
KnownMimeTypes.Application.VndIbmRightsManagement,
KnownMimeTypes.Application.VndIbmSecureContainer,
KnownMimeTypes.Application.VndIccprofile,
KnownMimeTypes.Application.VndIgloader,
KnownMimeTypes.Application.VndImmervisionIvp,
KnownMimeTypes.Application.VndImmervisionIvu,
KnownMimeTypes.Application.ReginfoXml,
KnownMimeTypes.Application.VndIntergeo,
KnownMimeTypes.Application.VndCinderella,
KnownMimeTypes.Application.VndInterconFormnet,
KnownMimeTypes.Application.VndIsacFcs,
KnownMimeTypes.Application.Ipfix,
KnownMimeTypes.Application.PkixCert,
KnownMimeTypes.Application.Pkixcmp,
KnownMimeTypes.Application.PkixCrl,
KnownMimeTypes.Application.PkixPkipath,
KnownMimeTypes.Application.VndInsorsIgm,
KnownMimeTypes.Application.VndIpunpluggedRcprofile,
KnownMimeTypes.Application.VndIrepositoryPackageXml,
KnownMimeTypes.Application.JavaArchive,
KnownMimeTypes.Application.JavaVm,
KnownMimeTypes.Application.XJavaJnlpFile,
KnownMimeTypes.Application.JavaSerializedObject,
KnownMimeTypes.Application.Javascript,
KnownMimeTypes.Application.Json,
KnownMimeTypes.Application.VndJoostJodaArchive,
KnownMimeTypes.Application.LdJson,
KnownMimeTypes.Application.VndKahootz,
KnownMimeTypes.Application.VndChipnutsKaraokeMmd,
KnownMimeTypes.Application.VndKdeKarbon,
KnownMimeTypes.Application.VndKdeKchart,
KnownMimeTypes.Application.VndKdeKformula,
KnownMimeTypes.Application.VndKdeKivio,
KnownMimeTypes.Application.VndKdeKontour,
KnownMimeTypes.Application.VndKdeKpresenter,
KnownMimeTypes.Application.VndKdeKspread,
KnownMimeTypes.Application.VndKdeKword,
KnownMimeTypes.Application.VndKenameaapp,
KnownMimeTypes.Application.VndKidspiration,
KnownMimeTypes.Application.VndKinar,
KnownMimeTypes.Application.VndKodakDescriptor,
KnownMimeTypes.Application.VndLasLasXml,
KnownMimeTypes.Application.XLatex,
KnownMimeTypes.Application.VndLlamagraphicsLifeBalanceDesktop,
KnownMimeTypes.Application.VndLlamagraphicsLifeBalanceExchangeXml,
KnownMimeTypes.Application.VndJam,
KnownMimeTypes.Application.VndLotus123,
KnownMimeTypes.Application.VndLotusApproach,
KnownMimeTypes.Application.VndLotusFreelance,
KnownMimeTypes.Application.VndLotusNotes,
KnownMimeTypes.Application.VndLotusOrganizer,
KnownMimeTypes.Application.VndLotusScreencam,
KnownMimeTypes.Application.VndLotusWordpro,
KnownMimeTypes.Application.MacBinhex40,
KnownMimeTypes.Application.VndMacportsPortpkg,
KnownMimeTypes.Application.VndOsgeoMapguidePackage,
KnownMimeTypes.Application.Marc,
KnownMimeTypes.Application.MarcxmlXml,
KnownMimeTypes.Application.Mxf,
KnownMimeTypes.Application.VndWolframPlayer,
KnownMimeTypes.Application.Mathematica,
KnownMimeTypes.Application.MathmlXml,
KnownMimeTypes.Application.Mbox,
KnownMimeTypes.Application.VndMedcalcdata,
KnownMimeTypes.Application.MediaservercontrolXml,
KnownMimeTypes.Application.VndMediastationCdkey,
KnownMimeTypes.Application.VndMfer,
KnownMimeTypes.Application.VndMfmp,
KnownMimeTypes.Application.MadsXml,
KnownMimeTypes.Application.MetsXml,
KnownMimeTypes.Application.ModsXml,
KnownMimeTypes.Application.Metalink4Xml,
KnownMimeTypes.Application.VndMcd,
KnownMimeTypes.Application.VndMicrografxFlo,
KnownMimeTypes.Application.VndMicrografxIgx,
KnownMimeTypes.Application.VndEszigno3Xml,
KnownMimeTypes.Application.XMsaccess,
KnownMimeTypes.Application.XMsdownload,
KnownMimeTypes.Application.VndMsArtgalry,
KnownMimeTypes.Application.VndMsCabCompressed,
KnownMimeTypes.Application.VndMsIms,
KnownMimeTypes.Application.XMsApplication,
KnownMimeTypes.Application.XMsclip,
KnownMimeTypes.Application.VndMsFontobject,
KnownMimeTypes.Application.VndMsExcel,
KnownMimeTypes.Application.VndMsExcelAddinMacroenabled12,
KnownMimeTypes.Application.VndMsExcelSheetBinaryMacroenabled12,
KnownMimeTypes.Application.VndMsExcelTemplateMacroenabled12,
KnownMimeTypes.Application.VndMsExcelSheetMacroenabled12,
KnownMimeTypes.Application.VndMsHtmlhelp,
KnownMimeTypes.Application.XMscardfile,
KnownMimeTypes.Application.VndMsLrm,
KnownMimeTypes.Application.XMsmediaview,
KnownMimeTypes.Application.XMsmoney,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentPresentationmlPresentation,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentPresentationmlSlide,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentPresentationmlSlideshow,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentPresentationmlTemplate,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentSpreadsheetmlSheet,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentSpreadsheetmlTemplate,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentWordprocessingmlDocument,
KnownMimeTypes.Application.VndOpenxmlformatsOfficedocumentWordprocessingmlTemplate,
KnownMimeTypes.Application.XMsbinder,
KnownMimeTypes.Application.VndMsOfficetheme,
KnownMimeTypes.Application.Onenote,
KnownMimeTypes.Application.VndMsPowerpoint,
KnownMimeTypes.Application.VndMsPowerpointAddinMacroenabled12,
KnownMimeTypes.Application.VndMsPowerpointSlideMacroenabled12,
KnownMimeTypes.Application.VndMsPowerpointPresentationMacroenabled12,
KnownMimeTypes.Application.VndMsPowerpointSlideshowMacroenabled12,
KnownMimeTypes.Application.VndMsPowerpointTemplateMacroenabled12,
KnownMimeTypes.Application.VndMsProject,
KnownMimeTypes.Application.XMspublisher,
KnownMimeTypes.Application.XMsschedule,
KnownMimeTypes.Application.XSilverlightApp,
KnownMimeTypes.Application.VndMsPkiStl,
KnownMimeTypes.Application.VndMsPkiSeccat,
KnownMimeTypes.Application.VndVisio,
KnownMimeTypes.Application.VndVisio2013,
KnownMimeTypes.Application.XMsWmd,
KnownMimeTypes.Application.VndMsWpl,
KnownMimeTypes.Application.XMsWmz,
KnownMimeTypes.Application.XMsmetafile,
KnownMimeTypes.Application.XMsterminal,
KnownMimeTypes.Application.Msword,
KnownMimeTypes.Application.VndMsWordDocumentMacroenabled12,
KnownMimeTypes.Application.VndMsWordTemplateMacroenabled12,
KnownMimeTypes.Application.XMswrite,
KnownMimeTypes.Application.VndMsWorks,
KnownMimeTypes.Application.XMsXbap,
KnownMimeTypes.Application.VndMsXpsdocument,
KnownMimeTypes.Application.VndIbmMinipay,
KnownMimeTypes.Application.VndIbmModcap,
KnownMimeTypes.Application.VndJcpJavameMidletRms,
KnownMimeTypes.Application.VndTmobileLivetv,
KnownMimeTypes.Application.XMobipocketEbook,
KnownMimeTypes.Application.VndMobiusMbk,
KnownMimeTypes.Application.VndMobiusDis,
KnownMimeTypes.Application.VndMobiusPlc,
KnownMimeTypes.Application.VndMobiusMqy,
KnownMimeTypes.Application.VndMobiusMsl,
KnownMimeTypes.Application.VndMobiusTxf,
KnownMimeTypes.Application.VndMobiusDaf,
KnownMimeTypes.Application.VndMophunCertificate,
KnownMimeTypes.Application.VndMophunApplication,
KnownMimeTypes.Application.Mp21,
KnownMimeTypes.Application.Mp4,
KnownMimeTypes.Application.VndAppleMpegurl,
KnownMimeTypes.Application.VndMusician,
KnownMimeTypes.Application.VndMuveeStyle,
KnownMimeTypes.Application.XvXml,
KnownMimeTypes.Application.VndNokiaNGageData,
KnownMimeTypes.Application.VndNokiaNGageSymbianInstall,
KnownMimeTypes.Application.XDtbncxXml,
KnownMimeTypes.Application.XNetcdf,
KnownMimeTypes.Application.VndNeurolanguageNlu,
KnownMimeTypes.Application.VndDna,
KnownMimeTypes.Application.VndNoblenetDirectory,
KnownMimeTypes.Application.VndNoblenetSealer,
KnownMimeTypes.Application.VndNoblenetWeb,
KnownMimeTypes.Application.VndNokiaRadioPreset,
KnownMimeTypes.Application.VndNokiaRadioPresets,
KnownMimeTypes.Application.VndNovadigmEdm,
KnownMimeTypes.Application.VndNovadigmEdx,
KnownMimeTypes.Application.VndNovadigmExt,
KnownMimeTypes.Application.VndFlographit,
KnownMimeTypes.Application.Oda,
KnownMimeTypes.Application.Ogg,
KnownMimeTypes.Application.VndOmaDd2Xml,
KnownMimeTypes.Application.VndOasisOpendocumentTextWeb,
KnownMimeTypes.Application.OebpsPackageXml,
KnownMimeTypes.Application.VndIntuQbo,
KnownMimeTypes.Application.VndOpenofficeorgExtension,
KnownMimeTypes.Application.VndYamahaOpenscoreformat,
KnownMimeTypes.Application.VndOasisOpendocumentChart,
KnownMimeTypes.Application.VndOasisOpendocumentChartTemplate,
KnownMimeTypes.Application.VndOasisOpendocumentDatabase,
KnownMimeTypes.Application.VndOasisOpendocumentFormula,
KnownMimeTypes.Application.VndOasisOpendocumentFormulaTemplate,
KnownMimeTypes.Application.VndOasisOpendocumentGraphics,
KnownMimeTypes.Application.VndOasisOpendocumentGraphicsTemplate,
KnownMimeTypes.Application.VndOasisOpendocumentImage,
KnownMimeTypes.Application.VndOasisOpendocumentImageTemplate,
KnownMimeTypes.Application.VndOasisOpendocumentPresentation,
KnownMimeTypes.Application.VndOasisOpendocumentPresentationTemplate,
KnownMimeTypes.Application.VndOasisOpendocumentSpreadsheet,
KnownMimeTypes.Application.VndOasisOpendocumentSpreadsheetTemplate,
KnownMimeTypes.Application.VndOasisOpendocumentText,
KnownMimeTypes.Application.VndOasisOpendocumentTextMaster,
KnownMimeTypes.Application.VndOasisOpendocumentTextTemplate,
KnownMimeTypes.Application.VndSunXmlCalc,
KnownMimeTypes.Application.VndSunXmlCalcTemplate,
KnownMimeTypes.Application.VndSunXmlDraw,
KnownMimeTypes.Application.VndSunXmlDrawTemplate,
KnownMimeTypes.Application.VndSunXmlImpress,
KnownMimeTypes.Application.VndSunXmlImpressTemplate,
KnownMimeTypes.Application.VndSunXmlMath,
KnownMimeTypes.Application.VndSunXmlWriter,
KnownMimeTypes.Application.VndSunXmlWriterGlobal,
KnownMimeTypes.Application.VndSunXmlWriterTemplate,
KnownMimeTypes.Application.XFontOtf,
KnownMimeTypes.Application.VndYamahaOpenscoreformatOsfpvgXml,
KnownMimeTypes.Application.VndOsgiDp,
KnownMimeTypes.Application.VndPalm,
KnownMimeTypes.Application.VndPawaafile,
KnownMimeTypes.Application.VndHpPclxl,
KnownMimeTypes.Application.VndPicsel,
KnownMimeTypes.Application.PicsRules,
KnownMimeTypes.Application.XChat,
KnownMimeTypes.Application.Pkcs10,
KnownMimeTypes.Application.XPkcs12,
KnownMimeTypes.Application.Pkcs7Mime,
KnownMimeTypes.Application.Pkcs7Signature,
KnownMimeTypes.Application.XPkcs7Certreqresp,
KnownMimeTypes.Application.XPkcs7Certificates,
KnownMimeTypes.Application.Pkcs8,
KnownMimeTypes.Application.VndPocketlearn,
KnownMimeTypes.Application.XFontPcf,
KnownMimeTypes.Application.FontTdpfr,
KnownMimeTypes.Application.XChessPgn,
KnownMimeTypes.Application.PskcXml,
KnownMimeTypes.Application.VndCtcPosml,
KnownMimeTypes.Application.Postscript,
KnownMimeTypes.Application.XFontType1,
KnownMimeTypes.Application.VndPowerbuilder6,
KnownMimeTypes.Application.PgpEncrypted,
KnownMimeTypes.Application.PgpSignature,
KnownMimeTypes.Application.VndPreviewsystemsBox,
KnownMimeTypes.Application.VndPviPtid1,
KnownMimeTypes.Application.PlsXml,
KnownMimeTypes.Application.VndPgFormat,
KnownMimeTypes.Application.VndPgOsasli,
KnownMimeTypes.Application.XFontLinuxPsf,
KnownMimeTypes.Application.VndPublishareDeltaTree,
KnownMimeTypes.Application.VndPmiWidget,
KnownMimeTypes.Application.VndQuarkQuarkxpress,
KnownMimeTypes.Application.VndEpsonEsf,
KnownMimeTypes.Application.VndEpsonMsf,
KnownMimeTypes.Application.VndEpsonSsf,
KnownMimeTypes.Application.VndEpsonQuickanime,
KnownMimeTypes.Application.VndIntuQfx,
KnownMimeTypes.Application.XRarCompressed,
KnownMimeTypes.Application.RsdXml,
KnownMimeTypes.Application.VndRnRealmedia,
KnownMimeTypes.Application.VndRealvncBed,
KnownMimeTypes.Application.VndRecordareMusicxml,
KnownMimeTypes.Application.VndRecordareMusicxmlXml,
KnownMimeTypes.Application.RelaxNgCompactSyntax,
KnownMimeTypes.Application.VndDataVisionRdz,
KnownMimeTypes.Application.RdfXml,
KnownMimeTypes.Application.VndCloantoRp9,
KnownMimeTypes.Application.VndJisp,
KnownMimeTypes.Application.Rtf,
KnownMimeTypes.Application.VndRoute66Link66Xml,
KnownMimeTypes.Application.RssXml,
KnownMimeTypes.Application.ShfXml,
KnownMimeTypes.Application.VndSailingtrackerTrack,
KnownMimeTypes.Application.VndSusCalendar,
KnownMimeTypes.Application.SruXml,
KnownMimeTypes.Application.SetPaymentInitiation,
KnownMimeTypes.Application.SetRegistrationInitiation,
KnownMimeTypes.Application.VndSema,
KnownMimeTypes.Application.VndSemd,
KnownMimeTypes.Application.VndSemf,
KnownMimeTypes.Application.VndSeemail,
KnownMimeTypes.Application.XFontSnf,
KnownMimeTypes.Application.ScvpVpRequest,
KnownMimeTypes.Application.ScvpVpResponse,
KnownMimeTypes.Application.ScvpCvRequest,
KnownMimeTypes.Application.ScvpCvResponse,
KnownMimeTypes.Application.Sdp,
KnownMimeTypes.Application.VndShanaInformedFormdata,
KnownMimeTypes.Application.VndShanaInformedFormtemplate,
KnownMimeTypes.Application.VndShanaInformedInterchange,
KnownMimeTypes.Application.VndShanaInformedPackage,
KnownMimeTypes.Application.ThraudXml,
KnownMimeTypes.Application.XShar,
KnownMimeTypes.Application.VndEpsonSalt,
KnownMimeTypes.Application.VndAccpacSimplyAso,
KnownMimeTypes.Application.VndAccpacSimplyImp,
KnownMimeTypes.Application.VndSimtechMindmapper,
KnownMimeTypes.Application.VndCommonspace,
KnownMimeTypes.Application.VndYamahaSmafAudio,
KnownMimeTypes.Application.VndSmaf,
KnownMimeTypes.Application.VndYamahaSmafPhrase,
KnownMimeTypes.Application.VndSmartTeacher,
KnownMimeTypes.Application.VndSvd,
KnownMimeTypes.Application.SparqlQuery,
KnownMimeTypes.Application.SparqlResultsXml,
KnownMimeTypes.Application.Srgs,
KnownMimeTypes.Application.SrgsXml,
KnownMimeTypes.Application.SsmlXml,
KnownMimeTypes.Application.VndKoan,
KnownMimeTypes.Application.VndStardivisionCalc,
KnownMimeTypes.Application.VndStardivisionDraw,
KnownMimeTypes.Application.VndStardivisionImpress,
KnownMimeTypes.Application.VndStardivisionMath,
KnownMimeTypes.Application.VndStardivisionWriter,
KnownMimeTypes.Application.VndStardivisionWriterGlobal,
KnownMimeTypes.Application.VndStepmaniaStepchart,
KnownMimeTypes.Application.XStuffit,
KnownMimeTypes.Application.XStuffitx,
KnownMimeTypes.Application.VndSolentSdkmXml,
KnownMimeTypes.Application.VndOlpcSugar,
KnownMimeTypes.Application.VndWqd,
KnownMimeTypes.Application.VndSymbianInstall,
KnownMimeTypes.Application.SmilXml,
KnownMimeTypes.Application.VndSyncmlXml,
KnownMimeTypes.Application.VndSyncmlDmWbxml,
KnownMimeTypes.Application.VndSyncmlDmXml,
KnownMimeTypes.Application.XSv4cpio,
KnownMimeTypes.Application.XSv4crc,
KnownMimeTypes.Application.SbmlXml,
KnownMimeTypes.Application.VndTaoIntentModuleArchive,
KnownMimeTypes.Application.XTar,
KnownMimeTypes.Application.XTcl,
KnownMimeTypes.Application.XTex,
KnownMimeTypes.Application.XTexTfm,
KnownMimeTypes.Application.TeiXml,
KnownMimeTypes.Application.VndSpotfireDxp,
KnownMimeTypes.Application.VndSpotfireSfs,
KnownMimeTypes.Application.TimestampedData,
KnownMimeTypes.Application.VndTridTpt,
KnownMimeTypes.Application.VndTriscapeMxs,
KnownMimeTypes.Application.VndTrueapp,
KnownMimeTypes.Application.XFontTtf,
KnownMimeTypes.Application.VndUmajin,
KnownMimeTypes.Application.VndUomlXml,
KnownMimeTypes.Application.VndUnity,
KnownMimeTypes.Application.VndUfdl,
KnownMimeTypes.Application.VndUiqTheme,
KnownMimeTypes.Application.XUstar,
KnownMimeTypes.Application.XCdlink,
KnownMimeTypes.Application.VndVsf,
KnownMimeTypes.Application.VndVcx,
KnownMimeTypes.Application.VndVisionary,
KnownMimeTypes.Application.CcxmlXml,
KnownMimeTypes.Application.VoicexmlXml,
KnownMimeTypes.Application.XWaisSource,
KnownMimeTypes.Application.VndWapWbxml,
KnownMimeTypes.Application.DavmountXml,
KnownMimeTypes.Application.XFontWoff,
KnownMimeTypes.Application.WspolicyXml,
KnownMimeTypes.Application.VndWebturbo,
KnownMimeTypes.Application.Widget,
KnownMimeTypes.Application.Winhlp,
KnownMimeTypes.Application.VndWapWmlscriptc,
KnownMimeTypes.Application.VndWordperfect,
KnownMimeTypes.Application.VndWtStf,
KnownMimeTypes.Application.WsdlXml,
KnownMimeTypes.Application.XX509CaCert,
KnownMimeTypes.Application.XXfig,
KnownMimeTypes.Application.XhtmlXml,
KnownMimeTypes.Application.Xml,
KnownMimeTypes.Application.XcapDiffXml,
KnownMimeTypes.Application.XencXml,
KnownMimeTypes.Application.PatchOpsErrorXml,
KnownMimeTypes.Application.ResourceListsXml,
KnownMimeTypes.Application.RlsServicesXml,
KnownMimeTypes.Application.ResourceListsDiffXml,
KnownMimeTypes.Application.XsltXml,
KnownMimeTypes.Application.XopXml,
KnownMimeTypes.Application.XXpinstall,
KnownMimeTypes.Application.XspfXml,
KnownMimeTypes.Application.VndMozillaXulXml,
KnownMimeTypes.Application.Yang,
KnownMimeTypes.Application.YinXml,
KnownMimeTypes.Application.VndZul,
KnownMimeTypes.Application.Zip,
KnownMimeTypes.Application.VndHandheldEntertainmentXml,
KnownMimeTypes.Application.VndZzazzDeckXml,
KnownMimeTypes.Audio.Adpcm,
KnownMimeTypes.Audio.XAac,
KnownMimeTypes.Audio.XAiff,
KnownMimeTypes.Audio.VndDeceAudio,
KnownMimeTypes.Audio.VndDigitalWinds,
KnownMimeTypes.Audio.VndDra,
KnownMimeTypes.Audio.VndDts,
KnownMimeTypes.Audio.VndDtsHd,
KnownMimeTypes.Audio.VndRip,
KnownMimeTypes.Audio.VndLucentVoice,
KnownMimeTypes.Audio.XMpegurl,
KnownMimeTypes.Audio.VndMsPlayreadyMediaPya,
KnownMimeTypes.Audio.XMsWma,
KnownMimeTypes.Audio.XMsWax,
KnownMimeTypes.Audio.Midi,
KnownMimeTypes.Audio.Mpeg,
KnownMimeTypes.Audio.Mp4,
KnownMimeTypes.Audio.VndNueraEcelp4800,
KnownMimeTypes.Audio.VndNueraEcelp7470,
KnownMimeTypes.Audio.VndNueraEcelp9600,
KnownMimeTypes.Audio.Ogg,
KnownMimeTypes.Audio.Webm,
KnownMimeTypes.Audio.Opus,
KnownMimeTypes.Audio.XPnRealaudio,
KnownMimeTypes.Audio.XPnRealaudioPlugin,
KnownMimeTypes.Audio.Basic,
KnownMimeTypes.Audio.XWav,
KnownMimeTypes.Chemical.XCdx,
KnownMimeTypes.Chemical.XCml,
KnownMimeTypes.Chemical.XCsml,
KnownMimeTypes.Chemical.XCif,
KnownMimeTypes.Chemical.XCmdf,
KnownMimeTypes.Chemical.XXyz,
KnownMimeTypes.Image.VndDxf,
KnownMimeTypes.Image.Avif,
KnownMimeTypes.Image.Bmp,
KnownMimeTypes.Image.PrsBtif,
KnownMimeTypes.Image.VndDvbSubtitle,
KnownMimeTypes.Image.XCmuRaster,
KnownMimeTypes.Image.Cgm,
KnownMimeTypes.Image.XCmx,
KnownMimeTypes.Image.VndDeceGraphic,
KnownMimeTypes.Image.VndDjvu,
KnownMimeTypes.Image.VndDwg,
KnownMimeTypes.Image.VndFujixeroxEdmicsMmr,
KnownMimeTypes.Image.VndFujixeroxEdmicsRlc,
KnownMimeTypes.Image.VndXiff,
KnownMimeTypes.Image.VndFst,
KnownMimeTypes.Image.VndFastbidsheet,
KnownMimeTypes.Image.VndFpx,
KnownMimeTypes.Image.VndNetFpx,
KnownMimeTypes.Image.XFreehand,
KnownMimeTypes.Image.G3fax,
KnownMimeTypes.Image.Gif,
KnownMimeTypes.Image.XIcon,
KnownMimeTypes.Image.Ief,
KnownMimeTypes.Image.Jpeg,
KnownMimeTypes.Image.XCitrixJpeg,
KnownMimeTypes.Image.Pjpeg,
KnownMimeTypes.Image.VndMsModi,
KnownMimeTypes.Image.Ktx,
KnownMimeTypes.Image.XPcx,
KnownMimeTypes.Image.VndAdobePhotoshop,
KnownMimeTypes.Image.XPict,
KnownMimeTypes.Image.XPortableAnymap,
KnownMimeTypes.Image.XPortableBitmap,
KnownMimeTypes.Image.XPortableGraymap,
KnownMimeTypes.Image.Png,
KnownMimeTypes.Image.XCitrixPng,
KnownMimeTypes.Image.XPng,
KnownMimeTypes.Image.XPortablePixmap,
KnownMimeTypes.Image.SvgXml,
KnownMimeTypes.Image.XRgb,
KnownMimeTypes.Image.Tiff,
KnownMimeTypes.Image.VndWapWbmp,
KnownMimeTypes.Image.Webp,
KnownMimeTypes.Image.XXbitmap,
KnownMimeTypes.Image.XXpixmap,
KnownMimeTypes.Image.XXwindowdump,
KnownMimeTypes.Message.Rfc822,
KnownMimeTypes.Model.VndDwf,
KnownMimeTypes.Model.VndColladaXml,
KnownMimeTypes.Model.VndGtw,
KnownMimeTypes.Model.VndGdl,
KnownMimeTypes.Model.Iges,
KnownMimeTypes.Model.Mesh,
KnownMimeTypes.Model.Vrml,
KnownMimeTypes.Model.VndMts,
KnownMimeTypes.Model.VndVtu,
KnownMimeTypes.Text.XAsm,
KnownMimeTypes.Text.PlainBas,
KnownMimeTypes.Text.XC,
KnownMimeTypes.Text.Css,
KnownMimeTypes.Text.Csv,
KnownMimeTypes.Text.VndCurl,
KnownMimeTypes.Text.VndCurlDcurl,
KnownMimeTypes.Text.VndCurlMcurl,
KnownMimeTypes.Text.VndCurlScurl,
KnownMimeTypes.Text.VndFmiFlexstor,
KnownMimeTypes.Text.XFortran,
KnownMimeTypes.Text.VndGraphviz,
KnownMimeTypes.Text.Html,
KnownMimeTypes.Text.Calendar,
KnownMimeTypes.Text.VndIn3d3dml,
KnownMimeTypes.Text.VndIn3dSpot,
KnownMimeTypes.Text.VndSunJ2meAppDescriptor,
KnownMimeTypes.Text.XJavaSourceJava,
KnownMimeTypes.Text.Javascript,
KnownMimeTypes.Text.VndFly,
KnownMimeTypes.Text.N3,
KnownMimeTypes.Text.XPascal,
KnownMimeTypes.Text.PrsLinesTag,
KnownMimeTypes.Text.Richtext,
KnownMimeTypes.Text.XSetext,
KnownMimeTypes.Text.Sgml,
KnownMimeTypes.Text.TabSeparatedValues,
KnownMimeTypes.Text.Plain,
KnownMimeTypes.Text.Troff,
KnownMimeTypes.Text.Turtle,
KnownMimeTypes.Text.UriList,
KnownMimeTypes.Text.XUuencode,
KnownMimeTypes.Text.XVcalendar,
KnownMimeTypes.Text.XVcard,
KnownMimeTypes.Text.VndWapWml,
KnownMimeTypes.Text.VndWapWmlscript,
KnownMimeTypes.Text.Yaml,
KnownMimeTypes.Video.V3gpp,
KnownMimeTypes.Video.V3gpp2,
KnownMimeTypes.Video.XMsvideo,
KnownMimeTypes.Video.VndDeceHd,
KnownMimeTypes.Video.VndDeceMobile,
KnownMimeTypes.Video.VndUvvuMp4,
KnownMimeTypes.Video.VndDecePd,
KnownMimeTypes.Video.VndDeceSd,
KnownMimeTypes.Video.VndDeceVideo,
KnownMimeTypes.Video.VndFvt,
KnownMimeTypes.Video.XF4v,
KnownMimeTypes.Video.XFlv,
KnownMimeTypes.Video.XFli,
KnownMimeTypes.Video.H261,
KnownMimeTypes.Video.H263,
KnownMimeTypes.Video.H264,
KnownMimeTypes.Video.Jpm,
KnownMimeTypes.Video.Jpeg,
KnownMimeTypes.Video.XM4v,
KnownMimeTypes.Video.XMsAsf,
KnownMimeTypes.Video.VndMsPlayreadyMediaPyv,
KnownMimeTypes.Video.XMsWm,
KnownMimeTypes.Video.XMsWmx,
KnownMimeTypes.Video.XMsWmv,
KnownMimeTypes.Video.XMsWvx,
KnownMimeTypes.Video.Mj2,
KnownMimeTypes.Video.Mp2t,
KnownMimeTypes.Video.VndMpegurl,
KnownMimeTypes.Video.Mpeg,
KnownMimeTypes.Video.Mp4,
KnownMimeTypes.Video.Ogg,
KnownMimeTypes.Video.Webm,
KnownMimeTypes.Video.Quicktime,
KnownMimeTypes.Video.XSgiMovie,
KnownMimeTypes.Video.VndVivo,
KnownMimeTypes.XConference.XCooltalk,
)

View File

@ -0,0 +1,8 @@
package dev.inmo.micro_utils.mime_types
import kotlinx.serialization.Serializable
@Serializable(MimeTypeSerializer::class)
interface MimeType {
val raw: String
}

View File

@ -0,0 +1,24 @@
package dev.inmo.micro_utils.mime_types
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
@Suppress("OPT_IN_USAGE")
@Serializer(MimeType::class)
object MimeTypeSerializer : KSerializer<MimeType> {
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("mimeType", PrimitiveKind.STRING)
override fun deserialize(decoder: Decoder): MimeType {
val mimeType = decoder.decodeString()
return mimeType(mimeType)
}
override fun serialize(encoder: Encoder, value: MimeType) {
encoder.encodeString(value.raw)
}
}

View File

@ -1,10 +1,5 @@
package dev.inmo.micro_utils.mime_types package dev.inmo.micro_utils.mime_types
import kotlinx.serialization.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
private val mimesCache = mutableMapOf<String, MimeType>().also { private val mimesCache = mutableMapOf<String, MimeType>().also {
knownMimeTypes.forEach { mimeType -> it[mimeType.raw] = mimeType } knownMimeTypes.forEach { mimeType -> it[mimeType.raw] = mimeType }
} }
@ -15,17 +10,3 @@ fun mimeType(raw: String) = mimesCache.getOrPut(raw) {
internal fun parseMimeType(raw: String): MimeType = CustomMimeType(raw) internal fun parseMimeType(raw: String): MimeType = CustomMimeType(raw)
@Suppress("OPT_IN_USAGE")
@Serializer(MimeType::class)
object MimeTypeSerializer : KSerializer<MimeType> {
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("mimeType", PrimitiveKind.STRING)
override fun deserialize(decoder: Decoder): MimeType {
val mimeType = decoder.decodeString()
return mimeType(mimeType)
}
override fun serialize(encoder: Encoder, value: MimeType) {
encoder.encodeString(value.raw)
}
}