opus-nt/scripts/api/main.py

21 lines
500 B
Python
Raw Normal View History

2019-12-26 06:20:41 +00:00
opus.main = Munch()
def _mainOutput(msg,verbosity = 0):
2019-12-21 04:37:38 +00:00
if opus.verbosity > verbosity - 1:
print(msg)
2019-12-27 04:38:59 +00:00
with open("opus-nt-" +str(opus.time)+ ".log","a") as file:
2019-12-26 06:20:41 +00:00
file.write(msg + "\n")
opus.main.output = _mainOutput
2019-12-21 04:37:38 +00:00
2019-12-26 06:20:41 +00:00
opus.script = Munch()
def _mainExecPy(_scriptPath):
opus.main.output("script -> execute -> " +_scriptPath,1)
2019-12-21 04:37:38 +00:00
_return = True
with open(_scriptPath) as _scriptFile:
exec(_scriptFile.read())
2019-12-26 06:20:41 +00:00
opus.main.output("done.",2)
2019-12-21 04:37:38 +00:00
return _return
2019-12-26 06:20:41 +00:00
opus.script.execute = _mainExecPy