Use config for title instead of icecast host

main
Jerry Aldrich 5 years ago
parent a7c673eaa0
commit b9541e7ffc
  1. 18
      player.html

@ -120,8 +120,9 @@
var configXMLHTTP = new XMLHttpRequest();
configXMLHTTP.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var data = JSON.parse(this.responseText);
loadStreamChoices(data)
CONFIG_DATA = JSON.parse(this.responseText);
renderStreamInfo()
loadStreamChoices(CONFIG_DATA)
}
};
configXMLHTTP.open("GET", "/config.json", true);
@ -211,21 +212,26 @@
statusXMLHTTP.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var streamData = JSON.parse(this.responseText);
title = streamData["icestats"]["host"]
songName = fetchText(streamData, "title")
listeners = fetchText(streamData, "listeners")
streamURL = fetchText(streamData, "streamurl")
renderStreamInfo(title, songName, listeners, streamURL)
renderStreamInfo(songName, listeners, streamURL)
}
};
statusXMLHTTP.open("GET", "/status-json.xsl", true);
statusXMLHTTP.send();
}
function renderStreamInfo(title="", songName="", listeners="", streamURL="") {
function renderStreamInfo(songName="", listeners="", streamURL="") {
width = 60
titleLine = buildTitleLine(width, title)
// Use an empty title while config.json is being loaded
if (typeof CONFIG_DATA !== 'undefined') {
titleLine = buildTitleLine(width, CONFIG_DATA["title"])
} else {
titleLine = buildTitleLine(width, "")
}
songNameLine = buildLine(width, songName, " Song Title: ")
listenersLine = buildLine(width, listeners, " Listeners: ")
downloadLine = buildDownloadLine(width, streamURL)

Loading…
Cancel
Save