opus-nt/scripts/api/main.py
2019-12-27 15:28:49 +01:00

32 lines
775 B
Python

opus.main = Munch()
def _mainOutput(msg,verbosity = 0):
if opus.verbosity > verbosity - 1:
print(msg)
with open("opus-nt-" +str(opus.time)+ ".log","a") as file:
file.write(msg + "\n")
opus.main.output = _mainOutput
opus.script = Munch()
def _mainExecPy(_scriptPath):
opus.main.output("script -> execute -> " +_scriptPath,1)
_return = True
with open(_scriptPath) as _scriptFile:
exec(_scriptFile.read())
opus.main.output("done.",2)
return _return
opus.script.execute = _mainExecPy
opus.temp = Munch()
def _tempRemove():
if os.path.isdir(opus.path.temp):
opus.main.output("clearing temp directory...",1)
try:
opus.reg.unmount()
except:
pass
rtn = subprocess.call(["rmdir","/s","/q",opus.path.temp],shell=True)
opus.temp.remove = _tempRemove