const minisrv_service_file = true; if (request_headers.query.category) { const wtvbgm = new WTVBGMusic(minisrv_config, session_data); const musicList = wtvbgm.getCategorySongList(request_headers.query.category); const 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.
`; let songsListed = 0; const divide = Math.round(musicList.length / 2, 0); Object.keys(musicList).forEach(function (k) { if (songsListed === divide) { data += `
`; } data += `
`; let strLenLimit = 16; if (musicList.length > 14) strLenLimit = 20; let songTitle = musicList[k]['title']; if (songTitle.length > strLenLimit) songTitle = musicList[k]['title'].slice(0, strLenLimit - 3) + "..."; if (musicList.length > 14) data += ''; data += `${songTitle}
`; if (musicList.length > 14) data += ''; songsListed++; }); data += `
`; } else { const errPage = wtvshared.doErrorPage("400", "Category ID is required."); headers = errPage[0]; data = errPage[1]; }