generate.js: replace setTags with addTags, add thelinuxexperience, fix displayType for items that used setDisplayType

This commit is contained in:
Jon 2022-12-08 14:29:33 +00:00
parent 2fb4ec8323
commit 1e925fd402

View File

@ -32,7 +32,6 @@ const RadioItem = function (id) {
RadioItem.new = id => new RadioItem(id) RadioItem.new = id => new RadioItem(id)
RadioItem.prototype.setMetadata = function (title, artist, href) { objBulkSet(this, "metadata", { title, artist, href }); return this } RadioItem.prototype.setMetadata = function (title, artist, href) { objBulkSet(this, "metadata", { title, artist, href }); return this }
RadioItem.prototype.addTags = function (tags) { this.tags = this.tags ? [ ...(this.tags), ...tags ] : tags; return this } RadioItem.prototype.addTags = function (tags) { this.tags = this.tags ? [ ...(this.tags), ...tags ] : tags; return this }
RadioItem.prototype.setTags = function (tags) { this.tags = tags; return this }
RadioItem.prototype.addSource = function (source) { this.sources.push(source); return this } RadioItem.prototype.addSource = function (source) { this.sources.push(source); return this }
RadioItem.prototype.setNiggadata = function (nigid, nigkey) { RadioItem.prototype.setNiggadata = function (nigid, nigkey) {
this.setMetadata() this.setMetadata()
@ -61,7 +60,6 @@ const EDisplayType = {
const RadioSource = function (type) { const RadioSource = function (type) {
this.type = type this.type = type
this.uri = null this.uri = null
this.display_type = type.startsWith("video/") ? EDisplayType.NATIVE : EDisplayType.SQUARE
this.previews = [] this.previews = []
return this return this
} }
@ -70,27 +68,29 @@ RadioSource.new = type => new RadioSource(type)
RadioSource.prototype.setDisplayType = function (display_type) { this.display_type = display_type; return this } RadioSource.prototype.setDisplayType = function (display_type) { this.display_type = display_type; return this }
RadioSource.prototype.setURI = function (uri) { this.uri = uri; return this } RadioSource.prototype.setURI = function (uri) { this.uri = uri; return this }
RadioSource.prototype.addPreview = function (uri, type, size, displayType=null) { RadioSource.prototype.addPreview = function (uri, type, size, displayType=null) {
this.previews.push(RadioPreview.new(uri, type, size, notNullElse(displayType, this.display_type))) this.previews.push(RadioPreview.new(uri, type, size, displayType))
return this return this
} }
RadioSource.prototype.serialize = function () { RadioSource.prototype.serialize = function () {
const self = this
return objSerialize(this, [ return objSerialize(this, [
"type", "type",
"uri" "uri"
], obj => ({ ...obj, "previews": this.previews.map(preview => preview.serialize()) })) ], obj => ({ ...obj, "previews": this.previews.map(preview => preview.serialize(self)) }))
} }
const RadioPreview = function (uri, type, size, displayType=null) { const RadioPreview = function (uri, type, size, displayType=null) {
this.uri = uri this.uri = uri
this.type = type this.type = type
this.size = size.replace(/x/g, "×") this.size = size.replace(/x/g, "×")
this.display_type = notNullElse(displayType, EDisplayType.SQUARE) this.display_type = displayType
return this return this
} }
RadioPreview.new = (uri, type, size, displayType) => new RadioPreview(uri, type, size, displayType) RadioPreview.new = (uri, type, size, displayType) => new RadioPreview(uri, type, size, displayType)
RadioPreview.prototype.serialize = function () { RadioPreview.prototype.serialize = function (radioSource) {
this.display_type = notNullElse(this.display_type, radioSource.type.startsWith("video/") ? EDisplayType.NATIVE : EDisplayType.SQUARE)
return objSerialize(this, [ return objSerialize(this, [
"display_type", "display_type",
"uri", "uri",
@ -176,7 +176,7 @@ const mediaItems = [
.addPreview("mxc://glowers.club/BczfFtojBhwMxTNjoZfhemam", "image/jpg", "638x360")), .addPreview("mxc://glowers.club/BczfFtojBhwMxTNjoZfhemam", "image/jpg", "638x360")),
RadioItem.new("femalecops") RadioItem.new("femalecops")
.setTags([ "misc" ]) .addTags([ "misc" ])
.addSource(RadioSource.new("video/mp4") .addSource(RadioSource.new("video/mp4")
.setURI("mxc://glowers.club/ZSyUyEGvOLOoUaqFVoCYPTif") .setURI("mxc://glowers.club/ZSyUyEGvOLOoUaqFVoCYPTif")
.addPreview("mxc://glowers.club/BVQhXkWSYbvFcSerzVZFgfrn", "image/jpg", "600x600")) .addPreview("mxc://glowers.club/BVQhXkWSYbvFcSerzVZFgfrn", "image/jpg", "600x600"))
@ -185,7 +185,7 @@ const mediaItems = [
.addPreview("mxc://glowers.club/BVQhXkWSYbvFcSerzVZFgfrn", "image/jpg", "600x600")), .addPreview("mxc://glowers.club/BVQhXkWSYbvFcSerzVZFgfrn", "image/jpg", "600x600")),
RadioItem.new("autisticclowns") RadioItem.new("autisticclowns")
.setTags([ "misc" ]) .addTags([ "misc" ])
.addSource(RadioSource.new("video/mp4") .addSource(RadioSource.new("video/mp4")
.setURI("mxc://glowers.club/fGszYTUkpyWsKuxphzJSfAZk") .setURI("mxc://glowers.club/fGszYTUkpyWsKuxphzJSfAZk")
.addPreview("mxc://glowers.club/esDPBgpoTvTtqekHAQJRwqtK", "image/jpg", "480x272")) .addPreview("mxc://glowers.club/esDPBgpoTvTtqekHAQJRwqtK", "image/jpg", "480x272"))
@ -215,7 +215,6 @@ const mediaItems = [
.setURI("mxc://glowers.club/egAyPBuGNFPYyvnMWMxySLiX") .setURI("mxc://glowers.club/egAyPBuGNFPYyvnMWMxySLiX")
.addPreview("mxc://glowers.club/dOxJvUWRlGqRRxJdpDRZyeko", "image/jpg", "640x360")), .addPreview("mxc://glowers.club/dOxJvUWRlGqRRxJdpDRZyeko", "image/jpg", "640x360")),
// TODO: Add metadata
RadioItem.new("feizhou") RadioItem.new("feizhou")
.setMetadata("Without the Communist Party, There Would Be No New China", "Brother Hao", "https://youtu.be/5tCMI0uKbBE") .setMetadata("Without the Communist Party, There Would Be No New China", "Brother Hao", "https://youtu.be/5tCMI0uKbBE")
.addSource(RadioSource.new("video/mp4") .addSource(RadioSource.new("video/mp4")
@ -275,7 +274,7 @@ const mediaItems = [
RadioItem.new("floyd") RadioItem.new("floyd")
.setMetadata("Paralyzer", "Finger Seven") .setMetadata("Paralyzer", "Finger Seven")
.setTags([ "misc" ]) .addTags([ "misc" ])
.addSource(RadioSource.new("video/mp4") .addSource(RadioSource.new("video/mp4")
.setURI("mxc://glowers.club/qtBuqQBqBrpyusCsWYXlgmtE") .setURI("mxc://glowers.club/qtBuqQBqBrpyusCsWYXlgmtE")
.addPreview("mxc://glowers.club/JjsGuJkEGAbudLaYvbAcxryQ", "image/jpg", "600x600")) .addPreview("mxc://glowers.club/JjsGuJkEGAbudLaYvbAcxryQ", "image/jpg", "600x600"))
@ -285,7 +284,7 @@ const mediaItems = [
RadioItem.new("amd") RadioItem.new("amd")
.setMetadata("Svetovid", "Jan Janko Močnik") .setMetadata("Svetovid", "Jan Janko Močnik")
.setTags([ "misc" ]) .addTags([ "misc" ])
.addSource(RadioSource.new("video/mp4") .addSource(RadioSource.new("video/mp4")
.setURI("mxc://glowers.club/wgQPrdTCUUTnKgpnwDVlEakc") .setURI("mxc://glowers.club/wgQPrdTCUUTnKgpnwDVlEakc")
.addPreview("mxc://glowers.club/GccquMupQGvDXYNeifUbxfuy", "image/jpg", "800x450")) .addPreview("mxc://glowers.club/GccquMupQGvDXYNeifUbxfuy", "image/jpg", "800x450"))
@ -296,7 +295,6 @@ const mediaItems = [
// TODO: Add thumbnail // TODO: Add thumbnail
RadioItem.new("israel") RadioItem.new("israel")
.setMetadata("Shake Israel's Security", "National Radio") .setMetadata("Shake Israel's Security", "National Radio")
.setTags([ "misc" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/cJMVPnPpkSZFHIRHtzXRrvna")), .setURI("mxc://glowers.club/cJMVPnPpkSZFHIRHtzXRrvna")),
@ -339,7 +337,7 @@ const mediaItems = [
RadioItem.new("negromancy") RadioItem.new("negromancy")
.setMetadata(undefined, undefined, "https://youtu.be/PxjA-jq1e7E") .setMetadata(undefined, undefined, "https://youtu.be/PxjA-jq1e7E")
.setTags([ "misc" ]) .addTags([ "misc" ])
.addSource(RadioSource.new("video/mp4") .addSource(RadioSource.new("video/mp4")
.setURI("mxc://glowers.club/kYDmqwhymAidlTbdFHHliXrk") .setURI("mxc://glowers.club/kYDmqwhymAidlTbdFHHliXrk")
.addPreview("mxc://glowers.club/qAtvGoVERlYfFnNWeizoYiGP", "image/jpg", "640x360")) .addPreview("mxc://glowers.club/qAtvGoVERlYfFnNWeizoYiGP", "image/jpg", "640x360"))
@ -377,49 +375,49 @@ const mediaItems = [
RadioItem.new("imposterd") RadioItem.new("imposterd")
.setMetadata("Among Us Eurobeat Remix", "maki ligon", "https://soundcloud.com/maki-ligon-deez-nutz/among-us-drip-eurobeat-remix") .setMetadata("Among Us Eurobeat Remix", "maki ligon", "https://soundcloud.com/maki-ligon-deez-nutz/among-us-drip-eurobeat-remix")
.setTags([ "sus" ]) .addTags([ "sus" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("x-gwm://include/imposterd.mp3") .setURI("x-gwm://include/imposterd.mp3")
.addPreview("x-gwm://include/crewmate.gif", "image/gif", "128x108")), .addPreview("x-gwm://include/crewmate.gif", "image/gif", "128x108")),
RadioItem.new("dripmachine") RadioItem.new("dripmachine")
.setMetadata("Amogus Drip Machine", "maki ligon", "https://soundcloud.com/maki-ligon-deez-nutz/amogus-drip-machine") .setMetadata("Amogus Drip Machine", "maki ligon", "https://soundcloud.com/maki-ligon-deez-nutz/amogus-drip-machine")
.setTags([ "sus" ]) .addTags([ "sus" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/DyboACFryZTCDeIgHtcRaBpL") .setURI("mxc://glowers.club/DyboACFryZTCDeIgHtcRaBpL")
.addPreview("mxc://glowers.club/VFehbVZaCVcNhQTYWuWRYTiM", "image/jpg", "500x500")), .addPreview("mxc://glowers.club/VFehbVZaCVcNhQTYWuWRYTiM", "image/jpg", "500x500")),
RadioItem.new("loneimposter") RadioItem.new("loneimposter")
.setMetadata("Lone Impostor", "maki ligon", "https://youtu.be/QbIckU4sXBM") .setMetadata("Lone Impostor", "maki ligon", "https://youtu.be/QbIckU4sXBM")
.setTags([ "sus" ]) .addTags([ "sus" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/oswdiINtTUUbQYEMEKpVmsHN") .setURI("mxc://glowers.club/oswdiINtTUUbQYEMEKpVmsHN")
.addPreview("mxc://glowers.club/jYlptPwURJXVMBNivxlBFPuP", "image/jpg", "1440x1440")), .addPreview("mxc://glowers.club/jYlptPwURJXVMBNivxlBFPuP", "image/jpg", "1440x1440")),
RadioItem.new("amogusdrip") RadioItem.new("amogusdrip")
.setMetadata("Among Us Drip Theme Song", "Leonz", "https://youtu.be/grd-K33tOSM") .setMetadata("Among Us Drip Theme Song", "Leonz", "https://youtu.be/grd-K33tOSM")
.setTags([ "sus" ]) .addTags([ "sus" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/xQHxUgpRUMtIkiBaszXiGAvh") .setURI("mxc://glowers.club/xQHxUgpRUMtIkiBaszXiGAvh")
.addPreview("mxc://glowers.club/erMHzidVOoqoWFXIxXAcozqW", "image/jpg", "512x512")), .addPreview("mxc://glowers.club/erMHzidVOoqoWFXIxXAcozqW", "image/jpg", "512x512")),
RadioItem.new("crewmate") RadioItem.new("crewmate")
.setMetadata("Among Us (Lofi Hip Hop Remix)", "Leonz", "https://youtu.be/gU39w8s54_Q") .setMetadata("Among Us (Lofi Hip Hop Remix)", "Leonz", "https://youtu.be/gU39w8s54_Q")
.setTags([ "sus" ]) .addTags([ "sus" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/txMHzslGxRyDmNVsUCObJRzc") .setURI("mxc://glowers.club/txMHzslGxRyDmNVsUCObJRzc")
.addPreview("mxc://glowers.club/PfEBpatFHatQubohkgQThOor", "image/jpg", "632x632")), .addPreview("mxc://glowers.club/PfEBpatFHatQubohkgQThOor", "image/jpg", "632x632")),
RadioItem.new("GETOUTOFMYHEAD") RadioItem.new("GETOUTOFMYHEAD")
.setMetadata("GETOUTOFMYHEAD", "placeboing", "https://youtu.be/Xnv38FnLkbM") .setMetadata("GETOUTOFMYHEAD", "placeboing", "https://youtu.be/Xnv38FnLkbM")
.setTags([ "sus" ]) .addTags([ "sus" ])
.addSource(RadioSource.new("video/mp4") .addSource(RadioSource.new("video/mp4")
.setURI("mxc://glowers.club/sEtheeOyZlztUtQuHOzOJpOk") .setURI("mxc://glowers.club/sEtheeOyZlztUtQuHOzOJpOk")
.addPreview("mxc://glowers.club/bJveZSEIXFsnEKdjDvwmmENo", "image/jpg", "800x450")), .addPreview("mxc://glowers.club/bJveZSEIXFsnEKdjDvwmmENo", "image/jpg", "800x450")),
RadioItem.new("gay") RadioItem.new("gay")
.setMetadata("I Am Gay", "Holland Boys", "https://youtu.be/cZs_nP1WufE") .setMetadata("I Am Gay", "Holland Boys", "https://youtu.be/cZs_nP1WufE")
.setTags([ "gay" ]) .addTags([ "gay" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/FAaatrvlEjJFljvNHhDhcNGl") .setURI("mxc://glowers.club/FAaatrvlEjJFljvNHhDhcNGl")
.addPreview("mxc://glowers.club/KrefLQCybeCNwLIFZwzWVolF", "image/png", "489x512")), .addPreview("mxc://glowers.club/KrefLQCybeCNwLIFZwzWVolF", "image/png", "489x512")),
@ -440,14 +438,14 @@ const mediaItems = [
RadioItem.new("bldm") RadioItem.new("bldm")
.setMetadata("Black Lives (Don't) Matter", "Moonman") .setMetadata("Black Lives (Don't) Matter", "Moonman")
.setTags([ "moonman" ]) .addTags([ "moonman" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/OXoYKzSBuKWHXcHDzZIaMfja") .setURI("mxc://glowers.club/OXoYKzSBuKWHXcHDzZIaMfja")
.addPreview("mxc://glowers.club/SYLXjGHjuXzBnReqrfoRnuhg", "image/jpg", "1024x966")), .addPreview("mxc://glowers.club/SYLXjGHjuXzBnReqrfoRnuhg", "image/jpg", "1024x966")),
RadioItem.new("amogusfloyd") RadioItem.new("amogusfloyd")
.setMetadata(undefined, undefined, "https://www.bitchute.com/video/PJXAu4xA4SUt/") .setMetadata(undefined, undefined, "https://www.bitchute.com/video/PJXAu4xA4SUt/")
.setTags([ "misc" ]) .addTags([ "misc" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/SzqNmhQOxaReaTmOegUItcHY") .setURI("mxc://glowers.club/SzqNmhQOxaReaTmOegUItcHY")
.addPreview("mxc://glowers.club/aHWNIqMTUjXZRGZUqZCuOgbi", "image/jpg", "898x480") .addPreview("mxc://glowers.club/aHWNIqMTUjXZRGZUqZCuOgbi", "image/jpg", "898x480")
@ -455,7 +453,7 @@ const mediaItems = [
RadioItem.new("whenblackissus") RadioItem.new("whenblackissus")
.setMetadata("Among Us theme song but it's in the style of Metallica's Black Album", "rex", "https://youtu.be/tA2Sr6GgbWo") .setMetadata("Among Us theme song but it's in the style of Metallica's Black Album", "rex", "https://youtu.be/tA2Sr6GgbWo")
.setTags([ "sus" ]) .addTags([ "sus" ])
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("mxc://glowers.club/VDXDeYltzQOhTChQtmsZaybu") .setURI("mxc://glowers.club/VDXDeYltzQOhTChQtmsZaybu")
.addPreview("mxc://glowers.club/JAWtHKTIefGJzYadLOUofaWl", "image/jpg", "1080x1080")), .addPreview("mxc://glowers.club/JAWtHKTIefGJzYadLOUofaWl", "image/jpg", "1080x1080")),
@ -498,7 +496,13 @@ const mediaItems = [
.setMetadata("Ave Maria", "Daniel Perret", "https://youtu.be/4swAeQGBvAs") .setMetadata("Ave Maria", "Daniel Perret", "https://youtu.be/4swAeQGBvAs")
.addSource(RadioSource.new("audio/mp3") .addSource(RadioSource.new("audio/mp3")
.setURI("x-gwm://wiki/avemaria.mp3") .setURI("x-gwm://wiki/avemaria.mp3")
.addPreview("mxc://glowers.club/UvQPlQTYoDjufDtdjZnPShmm", "image/png", "546x546")) .addPreview("mxc://glowers.club/UvQPlQTYoDjufDtdjZnPShmm", "image/png", "546x546")),
RadioItem.new("thelinuxexperience")
.addTags([ "misc" ])
.addSource(RadioSource.new("video/mp4")
.setURI("mxc://glowers.club/kzIdHQbGtQIdEitOruQHrXnM")
.addPreview("mxc://glowers.club/wKPEYlKdaZiSdCDbImBInvxm", "image/jpg", "936x558"))
].filter(Boolean).map(a => a.serialize()).sort((a,b) => a.id.localeCompare(b.id)) ].filter(Boolean).map(a => a.serialize()).sort((a,b) => a.id.localeCompare(b.id))