commit 13/10/2025
Soundbank menu
This commit is contained in:
@@ -36,6 +36,7 @@ import io.javalin.http.Context
|
||||
import io.javalin.json.JavalinJackson
|
||||
import io.javalin.websocket.WsMessageContext
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook
|
||||
import java.nio.file.Files
|
||||
import java.time.LocalDateTime
|
||||
|
||||
@Suppress("unused")
|
||||
@@ -213,6 +214,33 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>) {
|
||||
it.result(objectmapper.writeValueAsString(ScheduleDay.entries.map { day -> day.toString() }))
|
||||
}
|
||||
}
|
||||
path("ListFiles/{Language}/{VoiceType}/{Category}") {
|
||||
get { ctx ->
|
||||
val language = ctx.pathParam("Language")
|
||||
val voiceType = ctx.pathParam("VoiceType")
|
||||
val category = ctx.pathParam("Category")
|
||||
if (ValidString(language) && Language.entries.any { lang -> lang.name == language }) {
|
||||
if (ValidString(voiceType) && VoiceType.entries.any { vt -> vt.name == voiceType }) {
|
||||
if (ValidString(category) && Category.entries.any { cat -> cat.name == category }) {
|
||||
val dir = Somecodes.SoundbankDirectory(
|
||||
Language.valueOf(language),
|
||||
VoiceType.valueOf(voiceType),
|
||||
Category.valueOf(category)
|
||||
)
|
||||
if (Files.isDirectory(dir)){
|
||||
val list = ListAudioFiles(dir)
|
||||
ctx.result(objectmapper.writeValueAsString(list))
|
||||
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Directory does not exist")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Invalid Category")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Invalid VoiceType")))
|
||||
} else ctx.status(400)
|
||||
.result(objectmapper.writeValueAsString(resultMessage("Invalid Language")))
|
||||
}
|
||||
}
|
||||
path("SoundBank") {
|
||||
get("List") {
|
||||
it.result(MariaDB.ArrayListtoString(db.soundDB.List))
|
||||
@@ -222,7 +250,7 @@ class WebApp(val listenPort: Int, val userlist: List<Pair<String, String>>) {
|
||||
}
|
||||
get("AirlineTags") { ctx ->
|
||||
val value = db.soundDB.List
|
||||
.filter { it.Category == Category.Airplane_Name.name }
|
||||
.filter { it.Category == Category.Airline_Name.name }
|
||||
.distinctBy { it.TAG }
|
||||
.sortedBy { it.TAG }
|
||||
.map { KeyValueMessage(it.TAG, it.Description) }
|
||||
|
||||
Reference in New Issue
Block a user