diff --git a/simpledemo.html b/simpledemo.html
index e0f498e..d2f4f7c 100644
--- a/simpledemo.html
+++ b/simpledemo.html
@@ -14,7 +14,8 @@
Please give the IP adress of you NetSpeaker here, so that this site can access its API.
@@ -541,18 +550,55 @@
alertPlaceholder.append(wrapper)
}
+ versionLabel1 = document.getElementById('updatedLabel_VERSION_title');
+ versionLabel2 = document.getElementById('updatedLabel_VERSION_table');
+ frnameLabel1 = document.getElementById('updatedLabel_FRNAME_title');
+ frnameLabel2 = document.getElementById('updatedLabel_FRNAME_table');
+ frnameLabel3 = document.getElementById('updatedLabel_FRNAME_oldinputtext');
+ restoreStateLabel1 = document.getElementById('updatedLabel_RESTORESTATE_table')
+ restorePlayingStateLabel1 = document.getElementById('updatedLabel_RESTOREPLAYING_table')
+ wifiLabel1 = document.getElementById('updatedLabel_WIFISSID_table');
+ const playingLabel1 = document.getElementById("updatedLabel_PLAYING_table_top");
+ const playingLabel2 = document.getElementById("updatedLabel_PLAYING_table_bottom");
+ const rs_plpathLabel1 = document.getElementById("updatedLabel_RS_PLPATH_table_top");
+ const rs_plidxLabel1 = document.getElementById("updatedLabel_RS_PLIDX_table_top");
+ const rs_pathLabel1 = document.getElementById("updatedLabel_RS_PATH_table_top");
+ const rs_typeLabel1 = document.getElementById("updatedLabel_RS_TYPE_table_top");
+ const rs_titleLabel1 = document.getElementById("updatedLabel_RS_TITLE_table_top");
+ const rs_albumLabel1 = document.getElementById("updatedLabel_RS_ALBUM_table_top");
+ const rs_artistLabel1 = document.getElementById("updatedLabel_RS_ARTIST_table_top");
+ const rs_tracknrLabel1 = document.getElementById("updatedLabel_RS_TRACKNR_table_top");
+ const rs_yearLabel1 = document.getElementById("updatedLabel_RS_YEAR_table_top");
+ const rs_genreLabel1 = document.getElementById("updatedLabel_RS_GENRE_table_top");
+ const rs_copyrightLabel1 = document.getElementById("updatedLabel_RS_COPYRIGHT_table_top");
+ const rs_languageLabel1 = document.getElementById("updatedLabel_RS_LANGUAGE_table_top");
+ volumeLabel1 = document.getElementById('updatedLabel_VOLUME_table_top');
+ volumeLabel2 = document.getElementById('updatedLabel_VOLUME_table_bottom');
+ mutedLabel1 = document.getElementById('updatedLabel_MUTED_table_top');
+ mutedLabel2 = document.getElementById('updatedLabel_MUTED_table_bottom');
+ eqLowLabel1 = document.getElementById('updatedLabel_EQLOW_table_top');
+ eqLowLabel2 = document.getElementById('updatedLabel_EQLOW_table_bottom');
+ eqMidLabel1 = document.getElementById('updatedLabel_EQMID_table_top');
+ eqMidLabel2 = document.getElementById('updatedLabel_EQMID_table_bottom');
+ eqHighLabel1 = document.getElementById('updatedLabel_EQHIGH_table_top');
+ eqHighLabel2 = document.getElementById('updatedLabel_EQHIGH_table_bottom');
+ balanceLabel1 = document.getElementById('updatedLabel_BALANCE_table_top');
+ balanceLabel2 = document.getElementById('updatedLabel_BALANCE_table_bottom');
+
+
function updateStrings() {
- apiBase = "http://" + document.cookie;
- versionApiEndpoint = "/api/v1/system/version";
- frnameApiEndpoint = "/api/v1/system/name";
- restoreStateApiEndpoint = "/api/v1/system/restore_state/get";
+ apiBase = "http://" + document.cookie;
+ versionApiEndpoint = "/api/v1/system/version";
+ frnameApiEndpoint = "/api/v1/system/name";
+ restoreStateApiEndpoint = "/api/v1/system/restore_state/get";
restorePlayingStateApiEndpoint = "/api/v1/system/restore_playing/get";
- wifiApiEndpoint = "/api/v1/system/wifi/get_ssid";
+ wifiApiEndpoint = "/api/v1/system/wifi/get_ssid";
+ playbackInfoApiEndpoint = "/api/v1/playback/info";
+ volumeApiEndpoint = "/api/v1/volume/get";
+ eqApiEndpoint = "/api/v1/eq/get";
+ balanceApiEndpoint = "/api/v1/balance/get";
/* Version string parser */
- versionLabel1 = document.getElementById('updatedLabel_VERSION_title');
- versionLabel2 = document.getElementById('updatedLabel_VERSION_table');
-
var versionRequest = new XMLHttpRequest();
versionRequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
@@ -566,10 +612,6 @@
/* friendly name parser */
- frnameLabel1 = document.getElementById('updatedLabel_FRNAME_title');
- frnameLabel2 = document.getElementById('updatedLabel_FRNAME_table');
- frnameLabel3 = document.getElementById('updatedLabel_FRNAME_oldinputtext');
-
var frnameRequest = new XMLHttpRequest();
frnameRequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
@@ -584,9 +626,6 @@
/* Save & Restore parser */
- restoreStateLabel1 = document.getElementById('updatedLabel_RESTORESTATE_table')
- restorePlayingStateLabel1 = document.getElementById('updatedLabel_RESTOREPLAYING_table')
-
var restoreStateRequest = new XMLHttpRequest();
restoreStateRequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
@@ -609,8 +648,6 @@
/* WiFi SSID parser */
- wifiLabel1 = document.getElementById('updatedLabel_WIFISSID_table');
-
var wifiRequest = new XMLHttpRequest();
wifiRequest.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
@@ -622,12 +659,78 @@
wifiRequest.send();
/* Playback info parser */
+ var playbackInfoRequest = new XMLHttpRequest();
+ playbackInfoRequest.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ var playbackInfoResponse = JSON.parse(this.responseText);
+
+ playingLabel1.innerHTML = playbackInfoResponse.state == "playing" ? "yes" : "no";
+ playingLabel2.innerHTML = playbackInfoResponse.state == "playing" ? "yes" : "no";
+ rs_plpathLabel1.innerHTML = playbackInfoResponse.resource_playlist_path;
+ rs_plidxLabel1.innerHTML = playbackInfoResponse.resource_playlist_index;
+ rs_pathLabel1.innerHTML = playbackInfoResponse.resource_path;
+ rs_typeLabel1.innerHTML = playbackInfoResponse.resource_type;
+ rs_titleLabel1.innerHTML = playbackInfoResponse.resource_title;
+ rs_albumLabel1.innerHTML = playbackInfoResponse.resource_album;
+ rs_artistLabel1.innerHTML = playbackInfoResponse.resource_artist;
+ rs_tracknrLabel1.innerHTML = playbackInfoResponse.resource_track;
+ rs_yearLabel1.innerHTML = playbackInfoResponse.resource_year;
+ rs_genreLabel1.innerHTML = playbackInfoResponse.resource_genre;
+ rs_copyrightLabel1.innerHTML = playbackInfoResponse.resource_copyright;
+ rs_languageLabel1.innerHTML = playbackInfoResponse.resource_tts_language;
+ }
+ }
+ playbackInfoRequest.open("GET", apiBase + playbackInfoApiEndpoint, true);
+ playbackInfoRequest.send();
+
+
+ /* Volume+Muted parser */
+ var volumeRequest = new XMLHttpRequest();
+ volumeRequest.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ var volumeValue = JSON.parse(this.responseText).volume;
+ var maxVolumeValue = JSON.parse(this.responseText).volume_max;
+ var mutedValue = JSON.parse(this.responseText).muted;
+ volumeLabel1.innerHTML = volumeValue + "/" + maxVolumeValue;
+ volumeLabel2.innerHTML = volumeValue + "/" + maxVolumeValue;
+ mutedLabel1.innerHTML = mutedValue ? "yes" : "no";
+ mutedLabel2.innerHTML = mutedValue ? "yes" : "no";
+ }
+ }
+ volumeRequest.open("GET", apiBase + volumeApiEndpoint, true);
+ volumeRequest.send();
- /* Volume parser */
/* Equalizer parser */
+ var eqRequest = new XMLHttpRequest();
+ eqRequest.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ var eqLowValue = JSON.parse(this.responseText).equalizer_low;
+ var eqMidValue = JSON.parse(this.responseText).equalizer_mid;
+ var eqHighValue = JSON.parse(this.responseText).equalizer_high;
+ eqLowLabel1.innerHTML = eqLowValue;
+ eqLowLabel2.innerHTML = eqLowValue;
+ eqMidLabel1.innerHTML = eqMidValue;
+ eqMidLabel2.innerHTML = eqMidValue;
+ eqHighLabel1.innerHTML = eqHighValue;
+ eqHighLabel2.innerHTML = eqHighValue;
+ }
+ }
+ eqRequest.open("GET", apiBase + eqApiEndpoint, true);
+ eqRequest.send();
+
/* Balance parser */
+ var balanceRequest = new XMLHttpRequest();
+ balanceRequest.onreadystatechange = function() {
+ if (this.readyState == 4 && this.status == 200) {
+ var balanceValue = JSON.parse(this.responseText).balance;
+ balanceLabel1.innerHTML = balanceValue;
+ balanceLabel2.innerHTML = balanceValue;
+ }
+ }
+ balanceRequest.open("GET", apiBase + balanceApiEndpoint, true);
+ balanceRequest.send();
}
@@ -678,4 +781,39 @@
} else if (isValidIP(document.cookie)) setupSite();