commit 13/10/2025
Soundbank menu
This commit is contained in:
@@ -260,7 +260,7 @@ class MainExtension01 {
|
||||
val value = variables["AL"].orEmpty()
|
||||
if (ValidString(value)) {
|
||||
val airplane =
|
||||
sb.firstOrNull { it.Category == Category.Airplane_Name.name && it.TAG == value }
|
||||
sb.firstOrNull { it.Category == Category.Airline_Name.name && it.TAG == value }
|
||||
if (airplane != null) {
|
||||
if (ValidFile(airplane.Path)) {
|
||||
files.add(airplane.Path)
|
||||
|
||||
@@ -349,7 +349,7 @@ class TCP_Android_Command_Server {
|
||||
.filter { it.isNotBlank() }
|
||||
.forEach { al ->
|
||||
val sb = db.soundDB.List
|
||||
.filter { it.Category.equals(Category.Airplane_Name.name, true) }
|
||||
.filter { it.Category.equals(Category.Airline_Name.name, true) }
|
||||
.filter { it.TAG.equals(al, true)}
|
||||
.distinctBy { it.TAG }
|
||||
VARAPTOTAL.addAll(sb)
|
||||
|
||||
@@ -3,7 +3,7 @@ package content
|
||||
@Suppress("unused")
|
||||
enum class Category(name: String) {
|
||||
Airline_Code("Airline_Code"),
|
||||
Airplane_Name("Airplane_Name"),
|
||||
Airline_Name("Airline_Name"),
|
||||
AlphabetNumeric("AlphabetNumeric"),
|
||||
City("City"),
|
||||
Phrase("Phrase"),
|
||||
|
||||
@@ -2280,7 +2280,7 @@ class MariaDB(
|
||||
|
||||
fun Find_Soundbank_AirplaneName(tag: String) : List<Soundbank>{
|
||||
return soundDB.List
|
||||
.filter{ it.Category== Category.Airplane_Name.name }
|
||||
.filter{ it.Category== Category.Airline_Name.name }
|
||||
.filter { it.TAG.equals(tag,true)}
|
||||
}
|
||||
|
||||
|
||||
@@ -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