Skip to content

Commit

Permalink
Updated media collection, as it excluded certain subtypes.
Browse files Browse the repository at this point in the history
  • Loading branch information
adam-rocska committed Sep 17, 2021
1 parent 4e10759 commit 2754a26
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 24 deletions.
20 changes: 18 additions & 2 deletions UtilityScripts/Medias.json
Original file line number Diff line number Diff line change
Expand Up @@ -1634,14 +1634,17 @@
"example",
"fits",
"g3fax",
"gif",
"heic",
"heic-sequence",
"heif",
"heif-sequence",
"hej2k",
"hsj2",
"ief",
"jls",
"jp2",
"jpeg",
"jph",
"jphc",
"jpm",
Expand Down Expand Up @@ -1695,14 +1698,15 @@
"vnd.xiff",
"vnd.zbrush.pcx",
"wmf",
"emf",
"wmf"
"x-emf",
"x-wmf"
],
"message": [
"CPIM",
"delivery-status",
"disposition-notification",
"example",
"external-body",
"feedback-report",
"global",
"global-delivery-status",
Expand All @@ -1711,6 +1715,8 @@
"http",
"imdn+xml",
"news",
"partial",
"rfc822",
"s-http",
"sip",
"sipfrag",
Expand All @@ -1725,6 +1731,7 @@
"gltf-binary",
"gltf+json",
"iges",
"mesh",
"mtl",
"obj",
"step",
Expand All @@ -1749,18 +1756,23 @@
"vnd.usdz+zip",
"vnd.valve.source.compiled-map",
"vnd.vtu",
"vrml",
"x3d-vrml",
"x3d+fastinfoset",
"x3d+xml"
],
"multipart": [
"alternative",
"appledouble",
"byteranges",
"digest",
"encrypted",
"example",
"form-data",
"header-set",
"mixed",
"multilingual",
"parallel",
"related",
"report",
"signed",
Expand All @@ -1782,6 +1794,7 @@
"dns",
"ecmascript",
"encaprtp",
"enriched",
"example",
"fhirpath",
"flexfec",
Expand All @@ -1796,13 +1809,15 @@
"n3",
"parameters",
"parityfec",
"plain",
"provenance-notation",
"prs.fallenstein.rst",
"prs.lines.tag",
"prs.prop.logic",
"raptorfec",
"RED",
"rfc822-headers",
"richtext",
"rtf",
"rtp-enc-aescm128",
"rtploopback",
Expand Down Expand Up @@ -1889,6 +1904,7 @@
"mp4",
"MP4V-ES",
"MPV",
"mpeg",
"mpeg4-generic",
"nv",
"ogg",
Expand Down
60 changes: 38 additions & 22 deletions UtilityScripts/MediasCollector.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
// Run this script in the browser on https://www.iana.org/assignments/media-types/media-types.xhtml#application
JSON.stringify(Array
.from(document.querySelectorAll('td'))
.filter(td => /.+\/.+/.test(td.textContent))
.map(td => td.textContent)
.map(s => s.trim())
.reduce((accumulator, entry) => entry.split('/').shift() in accumulator
? {
...accumulator,
[entry.split('/').shift()]: accumulator[entry.split('/').shift()].concat(entry.split('/').pop())
}
: accumulator
, {
application: [],
audio: [],
font: [],
image: [],
message: [],
model: [],
multipart: [],
text: [],
video: []
})

const validTypes = [
"application",
"audio",
"font",
"image",
"message",
"model",
"multipart",
"text",
"video",
];

JSON.stringify(validTypes
.map(type => [type, `table-${type}`])
.map(([type, id]) => [type, document.getElementById(id)])
.map(([type, table]) => [type, table.querySelector('tbody')])
.map(([type, tbody]) => [
type,
Array
.from(tbody.rows)
.map(row => row.cells[0].textContent.trim())
.map(subtype => subtype.split(" ")[0])
])
.reduce((accumulator, [type, subtypes]) => ({
...accumulator,
[type]: (accumulator.type || []).concat(subtypes)
}), {
application: [],
audio: [],
font: [],
image: [],
message: [],
model: [],
multipart: [],
text: [],
video: []
})
)

// Run this script in the browser on https://www.iana.org/assignments/media-type-structured-suffix/media-type-structured-suffix.xml
Expand Down

0 comments on commit 2754a26

Please sign in to comment.