@@ -109,57 +109,60 @@ def RecordActivity(self, text):
109109
110110 def OnStreamlabsEventHandler (self , data ):
111111 try :
112- event = StreamlabsEvent (self , data )
113- if event .errored :
114- self .logging .DebugLog (
115- "Streamlabs event errored during initial handling: " + str (event ))
116- return
117- if event .ignored :
118- self .logging .DebugLog (
119- "Streamlabs event being ignored: " + event .GetEventRawTitlesAsPrettyString ())
120- return
121112 self .logging .DebugLog (
122113 "Streamlabs raw event data: " + str (data ))
123- if not event .IsHandledEvent ():
124- self .RecordActivity (
125- self .translations .GetTranslation ("StreamlabsEvent UnrecognisedEvent" ) + event .GetEventRawTitlesAsPrettyString ())
126- return
127- if not event .PopulateNormalisedData ():
128- self .RecordActivity (
129- self .translations .GetTranslation ("StreamlabsEvent ErrorProcessingEvent" ) + event .GetEventRawTitlesAsPrettyString ())
114+ events = StreamlabsEventUtils .GenerateEventPerPayload (self , data )
115+ if events == None :
130116 return
131- self .logging .DebugLog (
132- "Streamlabs processed event: " + str (event ))
133-
134- actionText = self .profiles .currentProfile .GetActionTextForEvent (
135- event )
136- if actionText == None :
137- self .RecordActivity (
138- self .translations .GetTranslation ("StreamlabsEvent NoProfileAction" ) + event .GetEventRawTitlesAsPrettyString ())
139- self .logging .DebugLog (
140- "No profile action for: " + event .GetEventRawTitlesAsPrettyString ())
141- return
142- actionType = ""
143- response = ""
144- if actionText == "" :
145- actionType = "Ignore event"
117+ for event in events :
118+ if event .errored :
119+ self .logging .DebugLog (
120+ "Streamlabs event errored during initial handling: " + str (event ))
121+ return
122+ if event .ignored :
123+ self .logging .DebugLog (
124+ "Streamlabs event being ignored: " + event .GetEventRawTitlesAsPrettyString ())
125+ return
126+ if not event .IsHandledEvent ():
127+ self .RecordActivity (
128+ self .translations .GetTranslation ("StreamlabsEvent UnrecognisedEvent" ) + event .GetEventRawTitlesAsPrettyString ())
129+ return
130+ if not event .PopulateNormalisedData ():
131+ self .RecordActivity (
132+ self .translations .GetTranslation ("StreamlabsEvent ErrorProcessingEvent" ) + event .GetEventRawTitlesAsPrettyString ())
133+ return
146134 self .logging .DebugLog (
147- "NOTHING action specified for: " + event .GetEventRawTitlesAsPrettyString ())
148- else :
149- actionType = "Rcon command"
150- try :
151- response = self .rcon .SendCommand (actionText )
152- except Exception as ex :
153- self .logging .RecordException (ex , "Rcon event failed" )
135+ "Streamlabs processed event: " + str (event ))
136+
137+ actionText = self .profiles .currentProfile .GetActionTextForEvent (
138+ event )
139+ if actionText == None :
154140 self .RecordActivity (
155- self .translations .GetTranslation ("Rcon CommandError" ) + actionText )
141+ self .translations .GetTranslation ("StreamlabsEvent NoProfileAction" ) + event .GetEventRawTitlesAsPrettyString ())
142+ self .logging .DebugLog (
143+ "No profile action for: " + event .GetEventRawTitlesAsPrettyString ())
156144 return
157- self .RecordActivity (
158- self .translations .GetTranslation ("StreamlabsEvent EventHandled" ) + event .GetEventRawTitlesAsPrettyString () + " : " + event .bestName + " : value " + str (event .value ) + " : " + actionType )
159- if response != "" :
145+ actionType = ""
146+ response = ""
147+ if actionText == "" :
148+ actionType = "Ignore event"
149+ self .logging .DebugLog (
150+ "NOTHING action specified for: " + event .GetEventRawTitlesAsPrettyString ())
151+ else :
152+ actionType = "Rcon command"
153+ try :
154+ response = self .rcon .SendCommand (actionText )
155+ except Exception as ex :
156+ self .logging .RecordException (ex , "Rcon event failed" )
157+ self .RecordActivity (
158+ self .translations .GetTranslation ("Rcon CommandError" ) + actionText )
159+ return
160160 self .RecordActivity (
161- self .translations .GetTranslation ("Rcon CommandResponseWarning" ) + response )
162- self .logging .DebugLog ("Action done: " + actionText )
161+ self .translations .GetTranslation ("StreamlabsEvent EventHandled" ) + event .GetEventRawTitlesAsPrettyString () + " : " + event .bestName + " : value " + str (event .value ) + " : " + actionType )
162+ if response != "" :
163+ self .RecordActivity (
164+ self .translations .GetTranslation ("Rcon CommandResponseWarning" ) + response )
165+ self .logging .DebugLog ("Action done: " + actionText )
163166 except Exception as ex :
164167 self .logging .RecordException (
165168 ex , "OBS Event Handler Critical Error - This event won't be processed" )
@@ -176,6 +179,14 @@ def OnTestEventButtonHandler(self):
176179 self .RecordActivity (
177180 self .translations .GetTranslation ("TestEvent ValueNotFloat" ) + str (testEventValue ))
178181 return
182+ testEventQuantity = self .gui .testEventQuantity .get ()
183+ if TestEvents .GetAttribute (testEventPlatform , testEventType , "quantityInput" ):
184+ try :
185+ testEventQuantity = int (testEventQuantity )
186+ except :
187+ self .RecordActivity (
188+ self .translations .GetTranslation ("TestEvent QuantityCountNotInt" ) + str (testEventQuantity ))
189+ return
179190 testEventPayloadCount = self .gui .testEventPayloadCount .get ()
180191 try :
181192 testEventPayloadCount = int (testEventPayloadCount )
@@ -186,7 +197,7 @@ def OnTestEventButtonHandler(self):
186197 self .translations .GetTranslation ("TestEvent PayloadCountNotInt" ) + str (testEventPayloadCount ))
187198 return
188199 testEvent = self .testEvents .GenerateTestEvent (
189- testEventPlatform , testEventType , testEventValue , testEventPayloadCount )
200+ testEventPlatform , testEventType , testEventValue , testEventQuantity , testEventPayloadCount )
190201 if testEvent != None :
191202 self .OnStreamlabsEventHandler (testEvent )
192203 else :
0 commit comments