commit 24/10/2025
This commit is contained in:
@@ -33,7 +33,7 @@ lateinit var audioPlayer: AudioPlayer
|
||||
val StreamerOutputs: MutableMap<String, BarixConnection> = HashMap()
|
||||
lateinit var udpreceiver: UDPReceiver
|
||||
lateinit var tcpreceiver: TCPReceiver
|
||||
const val version = "0.0.10 (20/10/2025)"
|
||||
const val version = "0.0.11 (24/10/2025)"
|
||||
// AAS 64 channels
|
||||
const val max_channel = 64
|
||||
|
||||
@@ -59,6 +59,8 @@ fun folder_preparation(){
|
||||
// sementara diset begini, nanti pake config file
|
||||
//Somecodes.Soundbank_directory = Paths.get("c:\\soundbank")
|
||||
Somecodes.Soundbank_directory = Paths.get(config.Get(configKeys.SOUNDBANK_DIRECTORY.key))
|
||||
Somecodes.SoundbankResult_directory = Somecodes.Soundbank_directory.resolve("SoundbankResult")
|
||||
Somecodes.PagingResult_directory = Somecodes.Soundbank_directory.resolve("PagingResult")
|
||||
Files.createDirectories(Somecodes.SoundbankResult_directory)
|
||||
Files.createDirectories(Somecodes.PagingResult_directory)
|
||||
Files.createDirectories(Somecodes.Soundbank_directory)
|
||||
|
||||
@@ -901,22 +901,22 @@ class MainExtension01 {
|
||||
when(remark){
|
||||
"GOP" -> {
|
||||
//TODO Combobox First_Call_Message_Chooser.
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GOP.toString())
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GOP.key)
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
"GBD" ->{
|
||||
// TODO Combobox Second_Call_Message_Chooser
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GBD.toString())
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GBD.key)
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
"GFC" ->{
|
||||
// TODO Combobox Final_Call_Message_Chooser
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GFC.toString())
|
||||
val remarkMsg = config.Get(configKeys.REMARK_GFC.key)
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
"FLD" ->{
|
||||
// TODO Combobox Landed_Message_Chooser
|
||||
val remarkMsg = config.Get(configKeys.REMARK_FLD.toString())
|
||||
val remarkMsg = config.Get(configKeys.REMARK_FLD.key)
|
||||
ann_id = Regex("\\[(\\d+)]").find(remarkMsg)?.value?.toIntOrNull() ?: 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package codes
|
||||
|
||||
import codes.Somecodes.Companion.Soundbank_directory
|
||||
import com.fasterxml.jackson.databind.JsonNode
|
||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
||||
import content.Category
|
||||
@@ -32,8 +33,8 @@ class Somecodes {
|
||||
val current_directory : String = System.getProperty("user.dir")
|
||||
var Soundbank_directory : Path = Path.of(current_directory,"Soundbank")
|
||||
|
||||
val SoundbankResult_directory : Path = Path.of(current_directory,"SoundbankResult")
|
||||
val PagingResult_directory : Path = Path.of(current_directory,"PagingResult")
|
||||
var SoundbankResult_directory : Path = Soundbank_directory.resolve("SoundbankResult")
|
||||
var PagingResult_directory : Path = Soundbank_directory.resolve("PagingResult")
|
||||
|
||||
val si = SystemInfo()
|
||||
val processor: CentralProcessor = si.hardware.processor
|
||||
|
||||
@@ -805,7 +805,7 @@ class MariaDB(
|
||||
"INSERT INTO ${super.dbName} (Description, Day, Time, Soundpath, `Repeat`, Enable, BroadcastZones, Language) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
val statement = connection.prepareStatement(sql)
|
||||
for (sb in data) {
|
||||
if (!ValidDate(sb.Day) || !ValidTime(sb.Time)) {
|
||||
if (!ValidScheduleDay(sb.Day) || !ValidTime(sb.Time)) {
|
||||
Logger.error("Invalid date or time format for schedulebank: ${sb.Description}" as Any)
|
||||
continue
|
||||
}
|
||||
@@ -834,7 +834,7 @@ class MariaDB(
|
||||
|
||||
|
||||
override fun UpdateByIndex(index: Int, data: ScheduleBank): Boolean {
|
||||
if (!ValidDate(data.Day)) {
|
||||
if (!ValidScheduleDay(data.Day)) {
|
||||
Logger.error("Error updating schedulebank entry: Invalid date format ${data.Day}" as Any)
|
||||
return false
|
||||
}
|
||||
@@ -915,16 +915,27 @@ class MariaDB(
|
||||
Clear()
|
||||
// read each row and insert into database
|
||||
val _schedulebankList = ArrayList<ScheduleBank>()
|
||||
//Logger.info{"Sheet last row num: ${sheet.lastRowNum}"}
|
||||
for (rowIndex in 1..sheet.lastRowNum) {
|
||||
val row = sheet.getRow(rowIndex) ?: continue
|
||||
//println(row)
|
||||
val description = row.getCell(1)?.stringCellValue ?: continue
|
||||
//println(description.toString())
|
||||
val day = row.getCell(2)?.stringCellValue ?: continue
|
||||
//println(day.toString())
|
||||
val time = row.getCell(3)?.stringCellValue ?: continue
|
||||
//println(time.toString())
|
||||
val soundpath = row.getCell(4)?.stringCellValue ?: continue
|
||||
//println(soundpath.toString())
|
||||
val repeat = row.getCell(5)?.stringCellValue?.toUByteOrNull() ?: continue
|
||||
val enable = row.getCell(6)?.stringCellValue?.toBooleanStrictOrNull() ?: continue
|
||||
// println(repeat.toString())
|
||||
//val enable = row.getCell(6)?.stringCellValue?.toBooleanStrictOrNull() ?: continue
|
||||
val enable = row.getCell(6)?.stringCellValue?.toBoolean() ?: continue
|
||||
//println(enable.toString())
|
||||
val broadcastZones = row.getCell(7)?.stringCellValue ?: continue
|
||||
//println(broadcastZones.toString())
|
||||
val language = row.getCell(8)?.stringCellValue ?: continue
|
||||
//println(language.toString())
|
||||
val schedulebank =
|
||||
ScheduleBank(
|
||||
0u,
|
||||
@@ -937,9 +948,10 @@ class MariaDB(
|
||||
broadcastZones,
|
||||
language
|
||||
)
|
||||
Logger.info{"SchedulebankList added 1"}
|
||||
|
||||
_schedulebankList.add(schedulebank)
|
||||
}
|
||||
|
||||
return scheduleDB.AddAll(_schedulebankList)
|
||||
} catch (e: Exception) {
|
||||
Logger.error { "Error importing Schedulebank, Msg: ${e.message}" }
|
||||
|
||||
@@ -16,7 +16,24 @@ data class ScheduleBank(
|
||||
return "ScheduleBank(index=$index, Description='$Description', Day='$Day', Time='$Time', Soundpath='$Soundpath', Repeat=$Repeat, Enable=$Enable, BroadcastZones='$BroadcastZones', Language='$Language')"
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if all string properties of the ScheduleBank are not empty.
|
||||
*/
|
||||
fun isNotEmpty() : Boolean{
|
||||
return Description.isNotEmpty() && Day.isNotEmpty() && Time.isNotEmpty() && Soundpath.isNotEmpty() && BroadcastZones.isNotEmpty() && Language.isNotEmpty()
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare two ScheduleBank objects for equality based on their properties.
|
||||
*/
|
||||
fun isEqual(other: ScheduleBank) : Boolean {
|
||||
return Description == other.Description &&
|
||||
Day == other.Day &&
|
||||
Time == other.Time &&
|
||||
Soundpath == other.Soundpath &&
|
||||
Repeat == other.Repeat &&
|
||||
Enable == other.Enable &&
|
||||
BroadcastZones == other.BroadcastZones &&
|
||||
Language == other.Language
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user