generate.js: negromancy
This commit is contained in:
parent
96d549ed2e
commit
9e91f0776f
55
generate.js
55
generate.js
@ -11,6 +11,14 @@ const objSerialize = (obj, keys, cb) => {
|
||||
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
|
||||
@ -20,9 +28,19 @@ const RadioItem = function (id) {
|
||||
}
|
||||
|
||||
RadioItem.new = id => new RadioItem(id)
|
||||
RadioItem.prototype.setMetadata = function (title, artist) { this.metadata = { title, artist }; 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.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",
|
||||
@ -245,7 +263,38 @@ const radioEntries = [
|
||||
.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/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/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")),
|
||||
|
||||
].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))
|
||||
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>`)
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user