Skip to content

Commit

Permalink
v0.0.6
Browse files Browse the repository at this point in the history
  • Loading branch information
nossebro committed Mar 28, 2021
1 parent 1c2dfc1 commit 5df2cf9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 12 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.0.6 - Script toggle

* Add script toggle
* Better reload of settings

## 0.0.5 - API_Key updates

* Minor code changes
Expand Down
35 changes: 23 additions & 12 deletions SocketReceiver_StreamlabsSystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
ScriptName = "SocketReceiver"
Website = "https://github.com/nossebro/SocketReceiver"
Creator = "nossebro"
Version = "0.0.5"
Version = "0.0.6"
Description = "Read events from the local SLCB socket"

#---------------------------------------
Expand Down Expand Up @@ -72,10 +72,9 @@ def DefaultSettings(self, settingsfile=None):
ui = json.load(f, encoding="utf-8")
for key in ui:
try:
defaults[key] = ui[key]['value']
defaults[key] = ui[key]["value"]
except:
if key != "output_file":
Parent.Log(ScriptName, "DefaultSettings(): Could not find key {0} in settings".format(key))
continue
return defaults

def Reload(self, jsondata):
Expand Down Expand Up @@ -161,15 +160,26 @@ def Unload():
# Chatbot Save Settings Function
#---------------------------------------
def ReloadSettings(jsondata):
global Logger
ScriptSettings.Reload(jsondata)
Logger.debug("Settings reloaded")

if LocalSocket and not LocalSocket.IsAlive:
if all (keys in LocalAPI for keys in ("Key", "Socket")):
LocalSocket.Connect()

Parent.BroadcastWsEvent('{0}_UPDATE_SETTINGS'.format(ScriptName.upper()), json.dumps(ScriptSettings.__dict__))
Logger.debug(json.dumps(ScriptSettings.__dict__), True)
if Logger:
Logger.debug("Settings reloaded")
Unload()
Init()

#---------------------------------------
# Chatbot Toggle Function
#---------------------------------------
def ScriptToggled(state):
global Logger
if state:
if not Logger:
Init()
Logger.debug("Script toggled on")
else:
Logger.debug("Script toggled off")
Unload()

#---------------------------------------
# Chatbot Execute Function
Expand Down Expand Up @@ -232,9 +242,10 @@ def LocalSocketDisconnected(ws, data):
# LocalSocket Error Function
#---------------------------------------
def LocalSocketError(ws, data):
global Logger
Logger.error(data.Message)
if data.Exception:
Logger.exception(data.Exception)
Logger.debug(data.Exception, exc_info=True)

#---------------------------------------
# LocalSocket Event Function
Expand Down

0 comments on commit 5df2cf9

Please sign in to comment.