glowers-radio/lib/build.js

18 lines
804 B
JavaScript
Raw Permalink Normal View History

"use-strict";
const fs = require("fs")
const { arrSerializeSort, toRadioSongs } = require("./util.js")
const { mediaItemsLint, mediaItemsSerialize } = require("./lint.js")
let songs = arrSerializeSort(require("../data/songs.js"))
mediaItemsLint(songs)
songs = toRadioSongs(songs)
console.info(`I: Version ${songs.version} with ${songs.songs.length} entries`)
fs.writeFileSync("./data/songs.json", JSON.stringify(songs))
//console.info(require("util").inspect(mediaItems[0], { colors: true, depth: Infinity }))
//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>`)