var minisrv_service_file = true; if (request_headers.query.category) { const wtvbgm = new WTVBGMusic(minisrv_config, session_data); var musicList = wtvbgm.getCategorySongList(request_headers.query.category); var categoryName = wtvbgm.getCategoryName(request_headers.query.category); headers = `200 OK Connection: Keep-Alive wtv-expire-all: wtv- wtv-expire-all: http Content-Type: text/html` data = ` ${categoryName}
${categoryName}
Choose the songs that you'd like to include.
`; var songsListed = 0; var divide = Math.round(musicList.length / 2, 0); Object.keys(musicList).forEach(function (k) { if (songsListed == divide) { data += `
`; } data += `
`; var strLenLimit = 16; if (musicList.length > 14) strLenLimit = 20; var songTitle = musicList[k]['title']; if (songTitle.length > strLenLimit) songTitle = musicList[k]['title'].substr(0, strLenLimit - 3) + "..."; if (musicList.length > 14) data += ''; data += `${songTitle}
`; if (musicList.length > 14) data += ''; songsListed++; }); data += `
`; } else { var errPage = doErrorPage("400", "Category ID is required."); headers = errPage[0]; data = errPage[1]; }