From 1e925fd402b1f6a97802b83b20cbfd944bba4674 Mon Sep 17 00:00:00 2001 From: Jon Date: Thu, 8 Dec 2022 14:29:33 +0000 Subject: [PATCH] generate.js: replace setTags with addTags, add thelinuxexperience, fix displayType for items that used setDisplayType --- generate.js | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/generate.js b/generate.js index 68ac982..24bf103 100755 --- a/generate.js +++ b/generate.js @@ -32,7 +32,6 @@ const RadioItem = function (id) { RadioItem.new = id => new RadioItem(id) 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.setTags = function (tags) { this.tags = tags; return this } RadioItem.prototype.addSource = function (source) { this.sources.push(source); return this } RadioItem.prototype.setNiggadata = function (nigid, nigkey) { this.setMetadata() @@ -61,7 +60,6 @@ const EDisplayType = { const RadioSource = function (type) { this.type = type this.uri = null - this.display_type = type.startsWith("video/") ? EDisplayType.NATIVE : EDisplayType.SQUARE this.previews = [] 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.setURI = function (uri) { this.uri = uri; return this } 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 } RadioSource.prototype.serialize = function () { + const self = this return objSerialize(this, [ "type", "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) { this.uri = uri this.type = type this.size = size.replace(/x/g, "×") - this.display_type = notNullElse(displayType, EDisplayType.SQUARE) + this.display_type = displayType return this } 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, [ "display_type", "uri", @@ -176,7 +176,7 @@ const mediaItems = [ .addPreview("mxc://glowers.club/BczfFtojBhwMxTNjoZfhemam", "image/jpg", "638x360")), RadioItem.new("femalecops") - .setTags([ "misc" ]) + .addTags([ "misc" ]) .addSource(RadioSource.new("video/mp4") .setURI("mxc://glowers.club/ZSyUyEGvOLOoUaqFVoCYPTif") .addPreview("mxc://glowers.club/BVQhXkWSYbvFcSerzVZFgfrn", "image/jpg", "600x600")) @@ -185,7 +185,7 @@ const mediaItems = [ .addPreview("mxc://glowers.club/BVQhXkWSYbvFcSerzVZFgfrn", "image/jpg", "600x600")), RadioItem.new("autisticclowns") - .setTags([ "misc" ]) + .addTags([ "misc" ]) .addSource(RadioSource.new("video/mp4") .setURI("mxc://glowers.club/fGszYTUkpyWsKuxphzJSfAZk") .addPreview("mxc://glowers.club/esDPBgpoTvTtqekHAQJRwqtK", "image/jpg", "480x272")) @@ -215,7 +215,6 @@ const mediaItems = [ .setURI("mxc://glowers.club/egAyPBuGNFPYyvnMWMxySLiX") .addPreview("mxc://glowers.club/dOxJvUWRlGqRRxJdpDRZyeko", "image/jpg", "640x360")), - // TODO: Add metadata RadioItem.new("feizhou") .setMetadata("Without the Communist Party, There Would Be No New China", "Brother Hao", "https://youtu.be/5tCMI0uKbBE") .addSource(RadioSource.new("video/mp4") @@ -275,7 +274,7 @@ const mediaItems = [ RadioItem.new("floyd") .setMetadata("Paralyzer", "Finger Seven") - .setTags([ "misc" ]) + .addTags([ "misc" ]) .addSource(RadioSource.new("video/mp4") .setURI("mxc://glowers.club/qtBuqQBqBrpyusCsWYXlgmtE") .addPreview("mxc://glowers.club/JjsGuJkEGAbudLaYvbAcxryQ", "image/jpg", "600x600")) @@ -285,7 +284,7 @@ const mediaItems = [ RadioItem.new("amd") .setMetadata("Svetovid", "Jan Janko Močnik") - .setTags([ "misc" ]) + .addTags([ "misc" ]) .addSource(RadioSource.new("video/mp4") .setURI("mxc://glowers.club/wgQPrdTCUUTnKgpnwDVlEakc") .addPreview("mxc://glowers.club/GccquMupQGvDXYNeifUbxfuy", "image/jpg", "800x450")) @@ -296,7 +295,6 @@ const mediaItems = [ // TODO: Add thumbnail RadioItem.new("israel") .setMetadata("Shake Israel's Security", "National Radio") - .setTags([ "misc" ]) .addSource(RadioSource.new("audio/mp3") .setURI("mxc://glowers.club/cJMVPnPpkSZFHIRHtzXRrvna")), @@ -339,7 +337,7 @@ const mediaItems = [ RadioItem.new("negromancy") .setMetadata(undefined, undefined, "https://youtu.be/PxjA-jq1e7E") - .setTags([ "misc" ]) + .addTags([ "misc" ]) .addSource(RadioSource.new("video/mp4") .setURI("mxc://glowers.club/kYDmqwhymAidlTbdFHHliXrk") .addPreview("mxc://glowers.club/qAtvGoVERlYfFnNWeizoYiGP", "image/jpg", "640x360")) @@ -377,49 +375,49 @@ const mediaItems = [ RadioItem.new("imposterd") .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") .setURI("x-gwm://include/imposterd.mp3") .addPreview("x-gwm://include/crewmate.gif", "image/gif", "128x108")), RadioItem.new("dripmachine") .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") .setURI("mxc://glowers.club/DyboACFryZTCDeIgHtcRaBpL") .addPreview("mxc://glowers.club/VFehbVZaCVcNhQTYWuWRYTiM", "image/jpg", "500x500")), RadioItem.new("loneimposter") .setMetadata("Lone Impostor", "maki ligon", "https://youtu.be/QbIckU4sXBM") - .setTags([ "sus" ]) + .addTags([ "sus" ]) .addSource(RadioSource.new("audio/mp3") .setURI("mxc://glowers.club/oswdiINtTUUbQYEMEKpVmsHN") .addPreview("mxc://glowers.club/jYlptPwURJXVMBNivxlBFPuP", "image/jpg", "1440x1440")), RadioItem.new("amogusdrip") .setMetadata("Among Us Drip Theme Song", "Leonz", "https://youtu.be/grd-K33tOSM") - .setTags([ "sus" ]) + .addTags([ "sus" ]) .addSource(RadioSource.new("audio/mp3") .setURI("mxc://glowers.club/xQHxUgpRUMtIkiBaszXiGAvh") .addPreview("mxc://glowers.club/erMHzidVOoqoWFXIxXAcozqW", "image/jpg", "512x512")), RadioItem.new("crewmate") .setMetadata("Among Us (Lofi Hip Hop Remix)", "Leonz", "https://youtu.be/gU39w8s54_Q") - .setTags([ "sus" ]) + .addTags([ "sus" ]) .addSource(RadioSource.new("audio/mp3") .setURI("mxc://glowers.club/txMHzslGxRyDmNVsUCObJRzc") .addPreview("mxc://glowers.club/PfEBpatFHatQubohkgQThOor", "image/jpg", "632x632")), RadioItem.new("GETOUTOFMYHEAD") .setMetadata("GETOUTOFMYHEAD", "placeboing", "https://youtu.be/Xnv38FnLkbM") - .setTags([ "sus" ]) + .addTags([ "sus" ]) .addSource(RadioSource.new("video/mp4") .setURI("mxc://glowers.club/sEtheeOyZlztUtQuHOzOJpOk") .addPreview("mxc://glowers.club/bJveZSEIXFsnEKdjDvwmmENo", "image/jpg", "800x450")), RadioItem.new("gay") .setMetadata("I Am Gay", "Holland Boys", "https://youtu.be/cZs_nP1WufE") - .setTags([ "gay" ]) + .addTags([ "gay" ]) .addSource(RadioSource.new("audio/mp3") .setURI("mxc://glowers.club/FAaatrvlEjJFljvNHhDhcNGl") .addPreview("mxc://glowers.club/KrefLQCybeCNwLIFZwzWVolF", "image/png", "489x512")), @@ -440,14 +438,14 @@ const mediaItems = [ RadioItem.new("bldm") .setMetadata("Black Lives (Don't) Matter", "Moonman") - .setTags([ "moonman" ]) + .addTags([ "moonman" ]) .addSource(RadioSource.new("audio/mp3") .setURI("mxc://glowers.club/OXoYKzSBuKWHXcHDzZIaMfja") .addPreview("mxc://glowers.club/SYLXjGHjuXzBnReqrfoRnuhg", "image/jpg", "1024x966")), RadioItem.new("amogusfloyd") .setMetadata(undefined, undefined, "https://www.bitchute.com/video/PJXAu4xA4SUt/") - .setTags([ "misc" ]) + .addTags([ "misc" ]) .addSource(RadioSource.new("audio/mp3") .setURI("mxc://glowers.club/SzqNmhQOxaReaTmOegUItcHY") .addPreview("mxc://glowers.club/aHWNIqMTUjXZRGZUqZCuOgbi", "image/jpg", "898x480") @@ -455,7 +453,7 @@ const mediaItems = [ RadioItem.new("whenblackissus") .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") .setURI("mxc://glowers.club/VDXDeYltzQOhTChQtmsZaybu") .addPreview("mxc://glowers.club/JAWtHKTIefGJzYadLOUofaWl", "image/jpg", "1080x1080")), @@ -498,7 +496,13 @@ const mediaItems = [ .setMetadata("Ave Maria", "Daniel Perret", "https://youtu.be/4swAeQGBvAs") .addSource(RadioSource.new("audio/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))