this works! command parsing for spawn and tts

This commit is contained in:
Brandon Thomas
2021-03-08 08:06:52 -05:00
parent 019b3e8b7e
commit c1dd44a08b
4 changed files with 56 additions and 6 deletions
@@ -13,20 +13,38 @@ FTtsRequest UProtocolLibrary::DecodeTtsPayload(const FString& payload)
if (input.Split(TEXT("|"), &Left, &input)) { if (input.Split(TEXT("|"), &Left, &input)) {
username = Left; username = Left;
if (input.Split(TEXT("|"), &Left, &Right)) { if (input.Split(TEXT(" "), &Left, &Right)) {
voiceName = Left; voiceName = Left;
text = Right; text = Right;
} }
} }
FTtsRequest request = FTtsRequest(); FTtsRequest request = FTtsRequest();
request.Username = username; request.Username = username.TrimStartAndEnd();
request.VoiceName = voiceName; request.VoiceName = voiceName.TrimStartAndEnd();
request.Text = text; request.Text = text.TrimStartAndEnd();
return request; return request;
} }
/*void UProtocolLibrary::DecodeTtsPayload() FSpawnRequest UProtocolLibrary::DecodeSpawnPayload(const FString& payload)
{ {
}*/ FString input = payload;
FString username = TEXT("");
FString model = TEXT("");
FString Left, Right;
if (input.Split(TEXT("|"), &Left, &Right)) {
username = Left;
model = Right;
}
FSpawnRequest request = FSpawnRequest();
request.Username = username.TrimStartAndEnd();
request.Model = model.TrimStartAndEnd();
return request;
}
@@ -18,4 +18,8 @@ public:
// Decode TTS instructions // Decode TTS instructions
UFUNCTION(BlueprintPure, Category = "EventCenterHelperFunctions") UFUNCTION(BlueprintPure, Category = "EventCenterHelperFunctions")
static FTtsRequest DecodeTtsPayload(const FString& payload); static FTtsRequest DecodeTtsPayload(const FString& payload);
// Decode Spawn instructions
UFUNCTION(BlueprintPure, Category = "EventCenterHelperFunctions")
static FSpawnRequest DecodeSpawnPayload(const FString& payload);
}; };
@@ -6,6 +6,9 @@
#include "ProtocolTypes.generated.h" #include "ProtocolTypes.generated.h"
/**
* Text to speech instructions.
*/
USTRUCT(BlueprintType) USTRUCT(BlueprintType)
struct EVENTCENTERPLUGIN_API FTtsRequest { struct EVENTCENTERPLUGIN_API FTtsRequest {
GENERATED_BODY() GENERATED_BODY()
@@ -21,3 +24,18 @@ public:
FString Text; FString Text;
}; };
/**
* Spawn instructions
*/
USTRUCT(BlueprintType)
struct EVENTCENTERPLUGIN_API FSpawnRequest {
GENERATED_BODY()
public:
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
FString Username;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly)
FString Model;
};
+10
View File
@@ -11,8 +11,18 @@ from aioredis.pubsub import Receiver
from aioredis.abc import AbcChannel from aioredis.abc import AbcChannel
CHANNELS = [ CHANNELS = [
# Text to speech
'tts',
'say',
'vocode', 'vocode',
# Object generation
'spawn', 'spawn',
# Teleport
'warp',
# Misc
'testing', 'testing',
] ]