commit 23/09/2025
This commit is contained in:
32
src/Main.kt
32
src/Main.kt
@@ -1,4 +1,6 @@
|
||||
import audio.AudioPlayer
|
||||
import barix.BarixConnection
|
||||
import barix.TCP_Barix_Command_Server
|
||||
import codes.Somecodes.Companion.dateformat1
|
||||
import codes.Somecodes.Companion.timeformat2
|
||||
import com.sun.jna.Platform
|
||||
@@ -20,6 +22,8 @@ import java.time.LocalTime
|
||||
|
||||
fun main() {
|
||||
val version = "0.0.1 (23/09/2025)"
|
||||
val StreamerOutputs : MutableMap<String, BarixConnection> = HashMap()
|
||||
|
||||
if (Platform.isWindows()) {
|
||||
// supaya OSHI bisa mendapatkan CPU usage di Windows seperti di Task Manager
|
||||
GlobalConfig.set(GlobalConfig.OSHI_OS_WINDOWS_CPU_UTILITY, true)
|
||||
@@ -141,5 +145,33 @@ fun main() {
|
||||
)
|
||||
web.Start()
|
||||
|
||||
val barixserver = TCP_Barix_Command_Server ()
|
||||
barixserver.StartTcpServer { cmd ->
|
||||
Logger.info{cmd}
|
||||
val _streamer = StreamerOutputs[cmd.ipaddress]
|
||||
val _sc = db.SoundChannelList.find { it.ip == cmd.ipaddress }
|
||||
if (_streamer==null){
|
||||
// belum create BarixConnection untuk ipaddress ini
|
||||
Logger.info{"New Streamer Output connection from ${cmd.ipaddress}"}
|
||||
if (_sc!=null){
|
||||
val _bc = BarixConnection(_sc.channel,cmd.ipaddress)
|
||||
_bc.vu = cmd.vu
|
||||
_bc.bufferRemain = cmd.buffremain
|
||||
_bc.statusData = cmd.statusdata
|
||||
StreamerOutputs[cmd.ipaddress] = _bc
|
||||
}
|
||||
|
||||
} else {
|
||||
// sudah ada, update data
|
||||
if (_sc !=null && !_sc.channel.equals(_streamer.channel)) {
|
||||
_streamer.channel = _sc.channel
|
||||
}
|
||||
_streamer.vu = cmd.vu
|
||||
_streamer.bufferRemain = cmd.buffremain
|
||||
_streamer.statusData = cmd.statusdata
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user