diff --git a/html/webpage/assets/js/overview.js b/html/webpage/assets/js/overview.js index 2ea3069..0f25bad 100644 --- a/html/webpage/assets/js/overview.js +++ b/html/webpage/assets/js/overview.js @@ -50,9 +50,12 @@ function getCardByIndex(index) { */ function UpdateStreamerCard(values) { if (!Array.isArray(values) || values.length === 0) return; - function setProgress($bar, value, max = 100) { + + function setProgress(index, $bar, value, max = 100) { const v = Number(value ?? 0); const pct = Math.max(0, Math.min(100, Math.round((v / max) * 100))); + //if (index!==1) return; // only update index 1 for testing + //console.log(`setProgress: index=${index}, value=${v}, pct=${pct}`); $bar .attr('aria-valuenow', v) // semantic value .css('width', pct + '%') // visual width @@ -68,7 +71,7 @@ function UpdateStreamerCard(values) { if (card.buffer) card.buffer.text(`Buffer: ${vv.bufferRemain !== undefined && vv.bufferRemain !== null ? vv.bufferRemain.toString() : 'N/A'}`); if (card.status) card.status.text(`Status: ${vv.isPlaying ? 'Playing' : 'Stopped'}`); if (card.vu) { - setProgress(card.vu, vv.vu, 100); + setProgress(i, card.vu, vv.vu, 100); } } else { // no value for this index, disable the card @@ -77,7 +80,7 @@ function UpdateStreamerCard(values) { if (card.buffer) card.buffer.text(`Buffer: N/A`); if (card.status) card.status.text(`Status: Disconnected`); if (card.vu) { - setProgress(card.vu, 0, 100); + setProgress(i, card.vu, 0, 100); } } } @@ -124,10 +127,13 @@ function fill_pagingqueuetablebody(vv) { if (!Array.isArray(vv) || vv.length === 0) return; vv.forEach(item => { // fill index and description columns using item properties - let description = `${item.Date_Time}_${item.Source}_${item.Type}_${item.Message}_${item.BroadcastZones}`; $('#pagingqueuetable').append(` ${item.index} - ${description} + ${item.date_Time} + ${item.source} + ${item.type} + ${item.message} + ${item.broadcastZones} `); let $addedrow = $('#pagingqueuetable tr:last'); $addedrow.off('click').on('click', function () { @@ -156,10 +162,14 @@ function fill_automaticqueuetablebody(vv) { if (!Array.isArray(vv) || vv.length === 0) return; vv.forEach(item => { // fill index and description columns using item properties - let description = `${item.Date_Time}_${item.Source}_${item.Type}_${item.Message}_${item.BroadcastZones}`; + //console.log("fill_automaticqueuetablebody: item", item); $('#automaticqueuetable').append(` ${item.index} - ${description} + ${item.date_Time} + ${item.source} + ${item.type} + ${item.message} + ${item.broadcastZones} `); let $addedrow = $('#automaticqueuetable tr:last'); $addedrow.off('click').on('click', function () { @@ -277,14 +287,18 @@ $(document).ready(function () { } }); - let intervaljob = null; + let intervaljob1 = null; + let intervaljob2 = null; function runIntervalJob() { - if (intervaljob) clearInterval(intervaljob); - intervaljob = setInterval(() => { + if (intervaljob1) clearInterval(intervaljob1); + intervaljob1 = setInterval(() => { + sendCommand("getStreamerOutputs", ""); + }, 100); + if (intervaljob2) clearInterval(intervaljob2); + intervaljob2 = setInterval(() => { sendCommand("getPagingQueue", ""); sendCommand("getAASQueue", ""); - sendCommand("getStreamerOutputs", ""); - }, 1000); + }, 2000); console.log("overview.js interval job started"); } @@ -309,22 +323,20 @@ $(document).ready(function () { case "getPagingQueue": let pq = JSON.parse(data); //console.log("getPagingQueue:", pq); + window.PagingQueue = []; if (Array.isArray(pq) && pq.length > 0) { - window.PagingQueue = []; window.PagingQueue.push(...pq); - console.log(`PagingQueue length: ${window.PagingQueue.length}`); - fill_pagingqueuetablebody(window.PagingQueue); } + fill_pagingqueuetablebody(window.PagingQueue); break; case "getAASQueue": let aq = JSON.parse(data); //console.log("getAASQueue:", aq); + window.QueueTable = []; if (Array.isArray(aq) && aq.length > 0) { - window.QueueTable = []; window.QueueTable.push(...aq); - console.log(`QueueTable length: ${window.QueueTable.length}`); - fill_automaticqueuetablebody(window.QueueTable); - } + } + fill_automaticqueuetablebody(window.QueueTable); break; case "getStreamerOutputs": /** @@ -337,13 +349,11 @@ $(document).ready(function () { } }); - - - - $(window).on('beforeunload', function () { console.log("overview.js beforeunload event triggered"); - clearInterval(intervaljob); - intervaljob = null; + clearInterval(intervaljob1); + clearInterval(intervaljob2); + intervaljob1 = null; + intervaljob2 = null; }); }); diff --git a/html/webpage/overview.html b/html/webpage/overview.html index ab5c9b1..0d31f99 100644 --- a/html/webpage/overview.html +++ b/html/webpage/overview.html @@ -19,8 +19,8 @@
- -
+ +
@@ -1263,7 +1263,7 @@

Status : Idle

-
+
50%
@@ -1274,16 +1274,20 @@
- -
+ +
- - + + + + + + @@ -1306,8 +1310,12 @@
IndexDescriptionIndexDate TimeSourceTypeMessageBroadcast Zones
- - + + + + + + diff --git a/src/Main.kt b/src/Main.kt index 220e7b4..bfda93f 100644 --- a/src/Main.kt +++ b/src/Main.kt @@ -31,7 +31,7 @@ lateinit var audioPlayer: AudioPlayer val StreamerOutputs: MutableMap = HashMap() lateinit var udpreceiver: UDPReceiver lateinit var tcpreceiver: TCPReceiver -const val version = "0.0.7 (15/10/2025)" +const val version = "0.0.8 (16/10/2025)" // AAS 64 channels const val max_channel = 64 @@ -167,7 +167,6 @@ fun main() { val barixserver = TCP_Barix_Command_Server() barixserver.StartTcpServer { cmd -> - //Logger.info { cmd } val _tcp = barixserver.getSocket(cmd.ipaddress) val _streamer = StreamerOutputs[cmd.ipaddress] val _sc = db.soundchannelDB.List.find { it.ip == cmd.ipaddress } @@ -177,7 +176,8 @@ fun main() { if (_sc != null) { val _bc = BarixConnection(_sc.index, _sc.channel, cmd.ipaddress) - _bc.vu = cmd.vu + // cmd.vu 0 - 32767, kita convert ke 0 - 100 + _bc.vu = ((1.0 * cmd.vu / 32767.0)* 100.0).toInt() _bc.bufferRemain = cmd.buffremain _bc.statusData = cmd.statusdata _bc.commandsocket = _tcp @@ -191,7 +191,8 @@ fun main() { if (_sc != null && _sc.channel != _streamer.channel) { _streamer.channel = _sc.channel } - _streamer.vu = cmd.vu + // cmd.vu 0 - 32767, kita convert ke 0 - 100 + _streamer.vu = ((1.0 * cmd.vu / 32767.0)* 100.0).toInt() _streamer.bufferRemain = cmd.buffremain _streamer.statusData = cmd.statusdata diff --git a/src/MainExtension01.kt b/src/MainExtension01.kt index eba04ce..b07618b 100644 --- a/src/MainExtension01.kt +++ b/src/MainExtension01.kt @@ -561,7 +561,7 @@ class MainExtension01 { .filter { it.Type=="PAGING" } list.forEach { qp -> - println("Processing $qp") + //println("Processing $qp") if (qp.BroadcastZones.isNotBlank()){ if (ValidFile(qp.Message)){ val zz = qp.BroadcastZones.split(";") @@ -883,7 +883,7 @@ class MainExtension01 { db.queuetableDB.Get() val list = db.queuetableDB.List.filter { it.Type=="SOUNDBANK" } list.forEach { qa -> - println("Processing $qa") + //println("Processing $qa") if (qa.BroadcastZones.isNotEmpty()){ val zz = qa.BroadcastZones.split(";") if (AllBroadcastZonesValid(zz)){ diff --git a/src/commandServer/TCP_Android_Command_Server.kt b/src/commandServer/TCP_Android_Command_Server.kt index 1b3f636..a7b176e 100644 --- a/src/commandServer/TCP_Android_Command_Server.kt +++ b/src/commandServer/TCP_Android_Command_Server.kt @@ -69,7 +69,7 @@ class TCP_Android_Command_Server { din.read(bb) // B4A format, 4 bytes di depan adalah size val str = String(bb, 4, bb.size - 4) - println("Received command from $key : $str") + //println("Received command from $key : $str") str.split("@").map { it.trim() }.filter { ValidString(it) } .forEach { process_command(key,it) { reply -> @@ -308,7 +308,7 @@ class TCP_Android_Command_Server { if (userlogin != null){ val userdb = db.userDB.List.find { it.username == username } if (userdb != null){ - println("Sending initialization data to $key with username $username") + //println("Sending initialization data to $key with username $username") val result = StringBuilder() // kirim Zone result.append("ZONE") diff --git a/src/database/MariaDB.kt b/src/database/MariaDB.kt index a064c3f..b80d882 100644 --- a/src/database/MariaDB.kt +++ b/src/database/MariaDB.kt @@ -1411,9 +1411,9 @@ class MariaDB( // use a temporary table to reorder the index statement?.executeUpdate("CREATE TABLE IF NOT EXISTS $tempdb_name LIKE ${super.dbName}") statement?.executeUpdate("TRUNCATE TABLE $tempdb_name") - statement?.executeUpdate("INSERT INTO $tempdb_name (Date_Time, Source, Type, Message, SB_TAGS) SELECT Date_Time, Source, Type, Message, SB_TAGS FROM ${super.dbName} ORDER BY `index` ") + statement?.executeUpdate("INSERT INTO $tempdb_name (Date_Time, Source, Type, Message, BroadcastZones) SELECT Date_Time, Source, Type, Message, BroadcastZones FROM ${super.dbName} ") statement?.executeUpdate("TRUNCATE TABLE ${super.dbName}") - statement?.executeUpdate("INSERT INTO ${super.dbName} (Date_Time, Source, Type, Message, SB_TAGS) SELECT Date_Time, Source, Type, Message, SB_TAGS FROM $tempdb_name") + statement?.executeUpdate("INSERT INTO ${super.dbName} (Date_Time, Source, Type, Message, BroadcastZones) SELECT Date_Time, Source, Type, Message, BroadcastZones FROM $tempdb_name") statement?.executeUpdate("DROP TABLE $tempdb_name") Logger.info("${super.dbName} table resorted by index" as Any) // reload the local list @@ -1436,7 +1436,7 @@ class MariaDB( val workbook = XSSFWorkbook() val sheet = workbook.createSheet("QueuePaging") val headerRow = sheet.createRow(0) - val headers = arrayOf("Index", "Date_Time", "Source", "Type", "Message", "SB_TAGS") + val headers = arrayOf("Index", "Date_Time", "Source", "Type", "Message", "BroadcastZones") for ((colIndex, header) in headers.withIndex()) { val cell = headerRow.createCell(colIndex) cell.setCellValue(header) @@ -1449,7 +1449,7 @@ class MariaDB( row.createCell(2).setCellValue(resultSet.getString("Source")) row.createCell(3).setCellValue(resultSet.getString("Type")) row.createCell(4).setCellValue(resultSet.getString("Message")) - row.createCell(5).setCellValue(resultSet.getString("SB_TAGS")) + row.createCell(5).setCellValue(resultSet.getString("BroadcastZones")) } for (i in headers.indices) { sheet.autoSizeColumn(i) diff --git a/src/web/WebApp.kt b/src/web/WebApp.kt index 56b32b6..e3a4a1d 100644 --- a/src/web/WebApp.kt +++ b/src/web/WebApp.kt @@ -87,7 +87,7 @@ class WebApp(val listenPort: Int, val userlist: List>) { } // Set user session it.sessionAttribute("user", user.first) - println("User ${user.first} logged in") + //println("User ${user.first} logged in") // Redirect to home page it.redirect("home.html") } @@ -97,10 +97,7 @@ class WebApp(val listenPort: Int, val userlist: List>) { before { CheckUsers(it) } ws("/ws") { ws -> // WebSocket endpoint for home - ws.onClose { wsCloseContext -> - // TODO Handle WebSocket close event - println("WebSocket closed: ${wsCloseContext.session.remoteAddress}") - } +// ws.onMessage { wsMessageContext -> try { val cmd = @@ -156,10 +153,9 @@ class WebApp(val listenPort: Int, val userlist: List>) { } } - ws.onConnect { wsConnectContext -> - // TODO Handle WebSocket connect event - println("WebSocket connected: ${wsConnectContext.session.remoteAddress}") - } +// ws.onConnect { wsConnectContext -> +// println("WebSocket connected: ${wsConnectContext.session.remoteAddress}") +// } } }
IndexDescriptionIndexDate TimeSourceTypeMessageBroadcast Zones