glowers-radio/generate.js
2022-11-13 04:08:28 +00:00

252 lines
9.7 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 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) { this.metadata = { title, artist }; 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.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")
.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", "Jan Janko Močnik")
.addSource(RadioSource.new("audio/mp3")
.setURL("mxc://glowers.club/egmaXMIHsNmblfDjyTGHdyas")
.setThumbnailURL("mxc://glowers.club/wpwHKoSFsxkNttaNyaNFzhMk")),
].filter(Boolean).map(a => a.serialize()).sort((a,b) => a.id.localeCompare(b.id))
fs.writeFileSync("./data/songs.js", `glowersRadioSongsCallback(${JSON.stringify(radioEntries)})`)
fs.writeFileSync("./data/songs.json", JSON.stringify(radioEntries))