glowers-radio/generate.js

337 lines
14 KiB
JavaScript
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env node
"use-strict";
const fs = require("fs")
const objSerialize = (obj, keys, cb) => {
let a = Object.create(null)
for (const key of keys)
a[key] = obj[key]
if (cb)
return cb(a)
return a
}
const objBulkSet = (obj, target, pairs) => {
if (typeof obj[target] != "object")
obj[target] = Object.create(null)
for (const key in pairs)
if (pairs[key] != undefined)
obj[target][key] = pairs[key]
}
const RadioItem = function (id) {
this.id = id
this.metadata = undefined
this.tags = undefined
this.sources = []
return this
}
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()
this.metadata._nigid = nigid
this.metadata._nigkey = nigkey
this.addTags([ "niggers" ])
//.setThumbnailType(EThumbnailType.STRETCH))
return this
}
RadioItem.prototype.serialize = function () {
return objSerialize(this, [
"id",
"tags",
"metadata"
], obj => ({ ...obj, "sources": this.sources.map(source => source.serialize()) }))
}
const EThumbnailType = {
"NATIVE": -1,
"SQUARE": 0,
"STRETCH": 1,
}
const RadioSource = function (type) {
this.type = type
this.url = null
this.thumbnail_type = type.startsWith("video/") ? EThumbnailType.NATIVE : EThumbnailType.SQUARE
this.thumbnail_url = undefined
return this
}
RadioSource.new = type => new RadioSource(type)
RadioSource.prototype.setThumbnailType = function (thumbnail_type) { this.thumbnail_type = thumbnail_type; return this }
RadioSource.prototype.setURL = function (uri) { this.url = uri; return this }
RadioSource.prototype.setThumbnailURL = function (uri) { this.thumbnail_url = uri; return this }
RadioSource.prototype.serialize = function () {
return objSerialize(this, [
"type",
"url",
"thumbnail_type",
"thumbnail_url"
])
}
const radioEntries = [
RadioItem.new("nightinjunitaki")
.setMetadata("Night In Junitaki", "Wünsche")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/night_in_junitaki_-_waves.mp3")
.setThumbnailURL("mxc://glowers.club/HCiiIVMOekjPZtiEaexDdUsD")),
RadioItem.new("goodbyeautumn")
.setMetadata("Goodbye Autumn", "Tomppabeats")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/goodbye_autumn.mp3")
.setThumbnailURL("mxc://glowers.club/HCiiIVMOekjPZtiEaexDdUsD")),
RadioItem.new("balmy")
.setMetadata("Balmy", "90sFlav")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/balmy90sblav.mp3")
.setThumbnailURL("mxc://glowers.club/kDNCBjvQxfPvtJVmfEMmcdov")),
RadioItem.new("springletter")
.setMetadata("Spring Letter", "90sFlav")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/spring_letter.mp3")
.setThumbnailURL("mxc://glowers.club/wTLwzrymoDeNGdJLEpDoEBtZ")),
RadioItem.new("weep")
.setMetadata("Weep", "90sFlav")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/weep.mp3")
.setThumbnailURL("mxc://glowers.club/jIkXGOSECsPPyJTvgrxPhRoq")),
RadioItem.new("whenimetyou")
.setMetadata("When I Met You", "90sFlav")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/when_i_met_you.mp3")
.setThumbnailURL("mxc://glowers.club/ntDKDFtqeQCmIVoRtzRQdvEC")),
RadioItem.new("sevenofnine")
.setMetadata("Seven of Nine", "90sFlav")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/seven_of_nine.mp3")
.setThumbnailURL("mxc://glowers.club/kDNCBjvQxfPvtJVmfEMmcdov")),
RadioItem.new("callme")
.setMetadata("Call Me", "90sFlav")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/call_me.mp3")
.setThumbnailURL("mxc://glowers.club/kDNCBjvQxfPvtJVmfEMmcdov")),
RadioItem.new("midnightsession")
.setMetadata("Midnight Session", "90sFlav")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/полуночная_сессия.mp3")
.setThumbnailURL("mxc://glowers.club/pLexnITqTOhJUXBOKtDAiZzv")),
// TODO: Add thumb
RadioItem.new("southdakota")
.setMetadata("South Dakota", "Keeloh")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://wiki/southdakota.mp3")),
RadioItem.new("dobson")
.addSource(RadioSource.new("video/mp4")
.setURL("mxc://glowers.club/mRtnfcoHYkyAOXSkYvrnbZgX")
.setThumbnailURL("mxc://glowers.club/eHKVfIITgdRKERhVOPSTDQAc")),
RadioItem.new("poljacked")
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/xnYQdrroEheIZBfigHGZferu")
.setThumbnailURL("mxc://glowers.club/BczfFtojBhwMxTNjoZfhemam")),
RadioItem.new("femalecops")
.setTags([ "misc" ])
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/RYjIfTiZKSKBdYBvjGtyBILa")
.setThumbnailURL("mxc://glowers.club/BVQhXkWSYbvFcSerzVZFgfrn")),
RadioItem.new("autisticclowns")
.setTags([ "misc" ])
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/WqYtubpqVplLjSxxmaxNeQir")
.setThumbnailURL("mxc://glowers.club/esDPBgpoTvTtqekHAQJRwqtK")),
RadioItem.new("ifuckinglovescience")
.setMetadata("I FUCKING LOVE SCIENCE", "Hank Green")
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/abgQasVrghOSkpRZTIfHMFyF")
.setThumbnailURL("mxc://glowers.club/IhivpcDssjnjSDHBdMEGGwVp"))
.addSource(RadioSource.new("video/mp4")
.setURL("mxc://glowers.club/ieQlfAlPPGeXLsvevolcQKqO")
.setThumbnailURL("mxc://glowers.club/IhivpcDssjnjSDHBdMEGGwVp")),
RadioItem.new("dootnukem")
.setMetadata("Grabbag", "Lee Jackson")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/xsuBJwyAUwuDoASbmqjZWrLO")
.setThumbnailURL("mxc://glowers.club/ymWgXucYRzhsgdiecjBkFvmz")
.setThumbnailType(EThumbnailType.STRETCH)),
RadioItem.new("hyperborea")
.setMetadata("Somebody That I Used to Know", "VelvetCasca")
.addSource(RadioSource.new("video/mp4")
.setURL("mxc://glowers.club/egAyPBuGNFPYyvnMWMxySLiX")
.setThumbnailURL("mxc://glowers.club/dOxJvUWRlGqRRxJdpDRZyeko")),
// 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")
.setURL("mxc://glowers.club/EuYQZnqLjRGPMocgqGqtKFpJ")
.setThumbnailURL("mxc://glowers.club/EuYQZnqLjRGPMocgqGqtKFpJ"))
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/EVRGpqeefZdsjVawOvSkOdvZ")
.setThumbnailURL("mxc://glowers.club/GywrCPMpcpsLFJQAuYoZRuzq")),
RadioItem.new("breathe")
.setMetadata("Breathe (in the Air)", "Pink Floyd")
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/HAGTNySLRemaDfjZMSmpktDj")
.setThumbnailURL("mxc://glowers.club/KytvUDmLWCFKQWwHemdDTksd")),
RadioItem.new("fuckjuice")
.setMetadata("Fuck Jannies and Fuck Juice", "The Crystal Crypt")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/bxMoRJmYFteVNNntNhqrniNJ")
.setThumbnailURL("mxc://glowers.club/YgeFvRPLguZOCGtUJFJednNj")),
RadioItem.new("onegame")
.setMetadata("ONE GAME", "Chris Voiceman")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/iejQiyaVtnqhuSSCuXqviAIN")
.setThumbnailURL("mxc://glowers.club/bZonXMZjhadXyazpKscvRBiP")),
RadioItem.new("imaginebeingdruckmann")
.setMetadata("Imagine Being Druckmann", "Chris Voiceman")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/wRsCVvtUiLzFnDjwwgkCnXzN")
.setThumbnailURL("mxc://glowers.club/ipWDVreHeWKOqefUBuvyFxjj")),
RadioItem.new("copeacabana")
.setMetadata("Cope-a-Cabana", "Chris Voiceman")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/zEmMFUyaIBmuqAeogVZAMrmO")
.setThumbnailURL("mxc://glowers.club/WBhXYzFgTyMVTTEWKwzDfsgF")),
RadioItem.new("jihad")
.setMetadata("Heyaw Rijal Al Qassam", "Inshad Ensemble")
.addSource(RadioSource.new("audio/mp3")
.setURL("x-gwm://gnujihad.mp3")
.setThumbnailURL("x-gwm://chromiumjihad.gif")),
RadioItem.new("thisistheinfowar")
.setMetadata("In the House, In a Heartbeat", "John Murphy")
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/znoCPlczXEXaEAVaiKHopnAV")
.setThumbnailURL("mxc://glowers.club/klXuXEwYNmYvsZhNOaXsDGJq")),
RadioItem.new("floyd")
.setMetadata("Paralyzer", "Finger Seven")
.setTags([ "misc" ])
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/IusHmBCOyJZFGHxsGjRkYqXf")
.setThumbnailURL("mxc://glowers.club/JjsGuJkEGAbudLaYvbAcxryQ")),
RadioItem.new("amd")
.setMetadata("Svetovid", "Jan Janko Močnik")
.setTags([ "misc" ])
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/RBvSWrEWiFtIuDUCoxZbCDTW")
.setThumbnailURL("mxc://glowers.club/GccquMupQGvDXYNeifUbxfuy")),
// TODO: Add thumbnail
RadioItem.new("israel")
.setMetadata("Shake Israel's Security", "National Radio")
.setTags([ "misc" ])
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/cJMVPnPpkSZFHIRHtzXRrvna")),
RadioItem.new("honorary")
.setMetadata("Erika", "Major Han Friess")
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/qMkbHHunSgPzkFpcoOuYeIuE")
.setThumbnailURL("mxc://glowers.club/aENkwWEKXIztqyBTJrBHCmRQ")),
RadioItem.new("bashar")
.setMetadata("God, Syria, and Bashar", "Rami Kazour")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/egmaXMIHsNmblfDjyTGHdyas")
.setThumbnailURL("mxc://glowers.club/wpwHKoSFsxkNttaNyaNFzhMk")),
RadioItem.new("hatethem")
.setMetadata("Niggerz Bop", "Mike David", "https://youtu.be/VkcAXS9IKdc")
.setNiggadata("hatethem", "585a286c042231244a73b19e")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/kYKpgAelvgRjDOVHJYKIYwdS")
.setThumbnailURL("mxc://glowers.club/IbShqtSWZksFbnOdFiVDFwqD"))
.addSource(RadioSource.new("audio/ogg")
.setURL("mxc://glowers.club/wdflEjUfqAkoyOyCDBXebDkw")
.setThumbnailURL("mxc://glowers.club/IbShqtSWZksFbnOdFiVDFwqD")),
RadioItem.new("wishmaster")
.setMetadata("Wishmaster", "Van Canto", "https://youtu.be/XCGQiGEYl4Y")
.setNiggadata("wishmaster", "570550d318f3c6dc5677b9f6")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/TWmjcXRxqaVOfYnWPItiPAcd")
.setThumbnailURL("mxc://glowers.club/OKTbfAlagYXulaeBmgwkNwii")
.setThumbnailType(EThumbnailType.STRETCH))
.addSource(RadioSource.new("audio/ogg")
.setURL("mxc://glowers.club/uaxDKxCUtRVXMWAJgoKeiNcJ")
.setThumbnailURL("mxc://glowers.club/OKTbfAlagYXulaeBmgwkNwii")
.setThumbnailType(EThumbnailType.STRETCH)),
RadioItem.new("negromancy")
.setMetadata(undefined, undefined, "https://youtu.be/PxjA-jq1e7E")
.setTags([ "misc" ])
.addSource(RadioSource.new("video/webm")
.setURL("mxc://glowers.club/hRDjowdyaPRkdrRkHtCeqGug")
.setThumbnailURL("mxc://glowers.club/qAtvGoVERlYfFnNWeizoYiGP")),
RadioItem.new("crocodilechop")
.setMetadata("Crocodile Chop", "Neil Cicierega", "https://soundcloud.com/neilcic/crocodile-chop")
.setNiggadata("crocodilechop", "570550d318f3c6dc5677b9d1")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/CIwbaGcPmsbqvZtdILxJxdHN")
.setThumbnailURL("mxc://glowers.club/ITHVCToEENFZhXGKaYuHplFV")),
RadioItem.new("tapeworms")
.setMetadata("I Staple Tapeworms on my Penis", "SillyJenny9000", "https://www.youtube.com/watch?v=v21iDJeWfVE")
.setNiggadata("tapeworms", "570550d318f3c6dc5677b9b0")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/NnrVJeWXXzqEUDhDQazMDYrr")
.setThumbnailURL("mxc://glowers.club/jKmUwOLJMGPAhdJGusuWCJgQ")),
RadioItem.new("withoutcosby")
.setMetadata("without cosby", "bong iguana", "https://soundcloud.com/bong-iguana/without-cosby")
.setNiggadata("withoutcosby", "570550d318f3c6dc5677b9e9")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/ERjkVBvKLvTIBEhOsEkWHENM")
.setThumbnailURL("mxc://glowers.club/xgoxdfvMRtmobnPMTrdqsQic")),
RadioItem.new("niggatorial")
.setMetadata("I'm The 2007 YouTube Tutorial", "▲A▲", "https://soundcloud.com/kraiqyttyj/im-the-2007-youtube-tutorial")
.setNiggadata("tutorial", "570550d318f3c6dc5677b9d7")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/XZGliHHOkhcxCSUxKoIkgUlI")
.setThumbnailURL("mxc://glowers.club/nAaKRXuNBjltAYJbsLnjGusH"))
].filter(Boolean).map(a => a.serialize()).sort((a,b) => a.id.localeCompare(b.id))
const radioObj = {
"version": 2,
"songs": radioEntries
}
fs.writeFileSync("./data/songs.json", JSON.stringify(radioObj))
//fs.writeFileSync("./data/songs.js", `glowersRadioSongsCallback(${JSON.stringify(radioObj)})`)
//fs.writeFileSync("./data/songs.html", `<html><script>glowersRadioSongsCallback(${JSON.stringify(radioObj)})</script></html>`)