82 lines
2.2 KiB
Python
82 lines
2.2 KiB
Python
import sys
|
|
import time
|
|
|
|
import twitch_script
|
|
import discord_script
|
|
import test_module
|
|
|
|
import user_module
|
|
|
|
import utilities_script as utility
|
|
import config as config
|
|
|
|
import credentials
|
|
|
|
import threading
|
|
import db
|
|
|
|
from enum import Enum
|
|
|
|
import config_management_module
|
|
|
|
class Thread_Management_Module():
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.dbCredential: credentials.DB_Credential
|
|
self.Config_Management_Module = config_management_module.Config_Management_Module()
|
|
self.threads = []
|
|
|
|
def main(self):
|
|
credentials_manager = credentials.Credentials_Module()
|
|
credentials_manager.load_credentials()
|
|
self.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
|
print("[Thread Management Module]> test")
|
|
|
|
def addThread(self, threadName):
|
|
return self.threads.append(self.makeThread(threadName))
|
|
|
|
def makeThread(self, threadName):
|
|
newThreadModule = ThreadModule_Type.get(threadName)
|
|
self.threads.append()
|
|
|
|
def startThread(self, threadName):
|
|
for t in self.threads:
|
|
if t.name == threadName:
|
|
t.start()
|
|
|
|
def stopThread(self, threadName):
|
|
for t in self.threads:
|
|
if t.name == threadName:
|
|
self.Config_Management_Module.editConfig(ThreadModule_ConfigBoolName_True.get(t.name), ThreadModule_ConfigBoolName_False.get(t.name))
|
|
utility.restart_self()
|
|
|
|
ThreadModule_Type = {
|
|
"Twitch" : twitch_script.Twitch_Module(),
|
|
"Discord" : discord_script.Discord_Module(),
|
|
"Test" : test_module.Test_Module(),
|
|
"User" : user_module.User_Module()
|
|
}
|
|
|
|
ThreadModule_ConfigBoolName_True = {
|
|
"Twitch" : "twitch_module: bool = True",
|
|
"Discord" : "discord_module: bool = True",
|
|
"Test" : "test_module: bool = True",
|
|
"User" : "user_module: bool = True"
|
|
}
|
|
|
|
ThreadModule_ConfigBoolName_False = {
|
|
"Twitch" : "twitch_module: bool = False",
|
|
"Discord" : "discord_module: bool = False",
|
|
"Test" : "test_module: bool = False",
|
|
"User" : "user_module: bool = False"
|
|
}
|
|
|
|
class Thread_():
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.dbCredential: credentials.DB_Credential
|
|
|
|
if __name__ == "__main__":
|
|
testModule = Thread_Management_Module()
|
|
|
|
testModule.main() |