var minisrv_service_file = true;
var WTVBGMusic = require("./WTVBGMusic.js");
var wtvbgm = new WTVBGMusic(minisrv_config, ssid_sessions[socket.ssid]);
if (request_headers.query.category) {
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.
`;
}
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];
}