From 7365c2e3ee63276ecf2c91b7fa18ff6026b115d5 Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 5 May 2021 14:06:52 -0400 Subject: [PATCH 1/4] progress --- timers_module.py | 90 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 63 insertions(+), 27 deletions(-) diff --git a/timers_module.py b/timers_module.py index b2dc872..7865f2f 100644 --- a/timers_module.py +++ b/timers_module.py @@ -5,7 +5,13 @@ import datetime import utilities_script as utility class timer(): - def __init__(self, name, startTime, endTime, trigger, trigger_exec, tempTimer = True): + def __init__(self, + name, + startTime = datetime.datetime.now, + endTime = datetime.datetime.now, + trigger = "", + trigger_exec = "", + tempTimer = True): self.name = name self.startTime = startTime self.endTime = endTime @@ -19,23 +25,53 @@ class Timers_Module(): self.timersList = [] def main(self): - self.createTimer() + self.createTimer("test_timer", seconds=30) + #self.updateTimersList() def updateTimersList(self): - pass + self.compile_and_load() - def createTimer(self, days=0, hours=0, minutes=0, seconds=0, microseconds=0, trigger="", trigger_exec="", tempTimer=True): - temp = datetime.datetime.now() - targetTime = temp + datetime.timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds, microseconds=microseconds) + def compile_and_load(self): + dic = {} + implementations = self.get_implementations_dir() + for dirName, subdirList, fileList in os.walk(implementations): + for file in fileList: + name, startTime, endTime, trigger, trigger_exec, tempTimer = self.readFile(file) + newTimer = timer(name, startTime, endTime, trigger, trigger_exec, tempTimer) - newTimer= timer() - newTimer.startTime = temp - newTimer.endTime = targetTime - newTimer.trigger = trigger - newTimer.trigger_exec = trigger_exec - newTimer.tempTimer = tempTimer + dic[newTimer.name] = newTimer + self.timersList.append(self.timersList) + break + return dic + + def get_base_dir(self) -> str: + cwd = os.getcwd() + split = os.path.split(cwd) + current = split[len(split) - 1] + if current == 'timers': + return self.check_dir(cwd) + elif current == 'Praxis_Bot' or current == 'Praxis': + return self.check_dir(os.path.join(cwd, "timers")) + else: + print("could not find working directory for Praxis_Bot/timers") + raise Exception + + def get_implementations_dir(self) -> str: + return self.check_dir(os.path.join(self.get_base_dir())) + + def check_dir(self, path: str) -> str: + if not os.path.exists(path): + os.mkdir(path, 0x777) + return path + + def createTimer(self, name, days=0, hours=0, minutes=0, seconds=0, microseconds=0, trigger="", trigger_exec="", tempTimer=True): + startTime = datetime.datetime.now() + targetTime = startTime + datetime.timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds, microseconds=microseconds) + + newTimer= timer(name, startTime, targetTime, trigger, trigger_exec, tempTimer) self.timersList.append(newTimer) + self.makeFile(newTimer) def checkTimer(self, name): @@ -57,27 +93,27 @@ class Timers_Module(): self.deleteTimer(name) - def makeFile(self, name, startTime, endTime, trigger, trigger_exec, tempTimer = True): - dir = utility.get_dir("stream_sources/timers") + def makeFile(self, timer_obj:timer): + dir = utility.get_dir("timers") script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in - relative_path = name + ".json" + relative_path = timer_obj.name + ".json" real_file_path = os.path.join(script_dir, relative_path) - with open(real_file_path, 'rw') as cred_r: - data = json.load(cred_r) - data['name'] = name - data['startTime'] = startTime - data['endTime'] = endTime - data['trigger'] = trigger - data['trigger_exec'] = trigger_exec - data['tempTimer'] = tempTimer + with open(real_file_path, 'r+') as cred_r: + data = json.load(timer_obj) + data['name'] = timer_obj.name + data['startTime'] = timer_obj.startTime + data['endTime'] = timer_obj.endTime + data['trigger'] = timer_obj.trigger + data['trigger_exec'] = timer_obj.trigger_exec + data['tempTimer'] = timer_obj.tempTimer with open(real_file_path, 'w') as cred_w: json.dump(data, cred_w, indent=2) def readFile(self, name): - dir = utility.get_dir("stream_sources/timers") + dir = utility.get_dir("timers") script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in - relative_path = name + ".json" + relative_path = name #+ ".json" real_file_path = os.path.join(script_dir, relative_path) startTime, endTime, trigger, tempTimer = None @@ -92,9 +128,9 @@ class Timers_Module(): return name, startTime, endTime, trigger, trigger_exec, tempTimer def deleteFile(self, name): - dir = utility.get_dir("stream_sources/timers") + dir = utility.get_dir("timers") script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in - relative_path = name + ".json" + relative_path = name #+ ".json" real_file_path = os.path.join(script_dir, relative_path) os.remove(real_file_path) -- 2.45.2 From 988f791a42af2e99c78b31371859e21bb6b1552d Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 5 May 2021 18:00:40 -0400 Subject: [PATCH 2/4] Working Version --- .gitignore | 1 + .../implemented/ChannelReward_Hydration.py | 32 +++-- standalone_webSource.py | 26 +++- timers_module.py | 131 +++++++++++++----- utilities_script.py | 6 + 5 files changed, 146 insertions(+), 50 deletions(-) diff --git a/.gitignore b/.gitignore index ac870d4..754534b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ credentials/ stream_sources/chyron.txt stream_sources/brb.txt *.log +timers/ diff --git a/channel_rewards/implemented/ChannelReward_Hydration.py b/channel_rewards/implemented/ChannelReward_Hydration.py index 9d932b3..3253b09 100644 --- a/channel_rewards/implemented/ChannelReward_Hydration.py +++ b/channel_rewards/implemented/ChannelReward_Hydration.py @@ -26,17 +26,27 @@ class ChannelReward_Hydration(AbstractChannelRewards, metaclass=ABCMeta): #print("sending:",user, 16, "!lights hydration") try: - if self.is_ChannelReward_enabled: - thread_ = threading.Thread(target=self.send_Lights_Command, args=(user, 16, "!lights hydration", "")) - thread_.daemon = True - self.threads.append(thread_) - thread_.start() - if self.is_ChannelReward_enabled: - prompt_ = self.get_Phrase(rewardPrompt) - thread_ = threading.Thread(target=self.send_TTS, args=(user, prompt_)) - thread_.daemon = True - self.threads.append(thread_) - thread_.start() + try: + if self.is_ChannelReward_enabled: + thread_ = threading.Thread(target=self.send_Lights_Command, args=(user, 16, "!lights hydration", "")) + thread_.daemon = True + self.threads.append(thread_) + thread_.start() + except: + if self.is_ChannelReward_enabled: + thread_ = threading.Thread(target=self.send_TTS, args=("", "Silly Nerd Fix The Lights Module")) + thread_.daemon = True + self.threads.append(thread_) + thread_.start() + try: + if self.is_ChannelReward_enabled: + prompt_ = self.get_Phrase(rewardPrompt) + thread_ = threading.Thread(target=self.send_TTS, args=(user, prompt_)) + thread_.daemon = True + self.threads.append(thread_) + thread_.start() + except: + pass except: pass diff --git a/standalone_webSource.py b/standalone_webSource.py index 13f17b4..31fcf2d 100644 --- a/standalone_webSource.py +++ b/standalone_webSource.py @@ -16,7 +16,13 @@ from cooldowns import Cooldown_Module import utilities_script as utility import chyron_module +import timers_module +import os +import praxis_logging +praxis_logger_obj = praxis_logging.praxis_logger() +praxis_logger_obj.init(os.path.basename(__file__)) +praxis_logger_obj.log("\n -Starting Logs: " + os.path.basename(__file__)) api:Flask = Flask(__name__) api.config["DEBUG"] = True @@ -40,12 +46,20 @@ def textSource_tempText(file_name): tempModule = tempText_Module.tempText_Module() return tempModule.getTempTextFile(file_name) -@api.route('/timer//') -def textSource_timers(timer_name): - #print("trying file: ", filename) - #tempModule = tempText_Module.tempText_Module() - #tempModule.getTempTextFile(filename) - return "Coming Soon" +@api.route('/timer/status//') +def textSource_timerStatus(timer_name): + tempModule = timers_module.Timers_Module() + result = tempModule.checkTimerStatus_fromFiles(timer_name) + returnString = "Timer %s is %s" % (timer_name, result) + return returnString + +@api.route('/timer/time//') +def textSource_timerTime(timer_name): + tempModule = timers_module.Timers_Module() + result = tempModule.checkTime_fromFiles(timer_name) + if result is None: result = "" + returnString = result + return returnString if __name__ == "__main__": init() diff --git a/timers_module.py b/timers_module.py index 7865f2f..22a2d97 100644 --- a/timers_module.py +++ b/timers_module.py @@ -1,8 +1,13 @@ import os import json +from praxis_logging import praxis_logger import time import datetime import utilities_script as utility +import importlib +import importlib.util +import sys +import inspect class timer(): def __init__(self, @@ -11,39 +16,55 @@ class timer(): endTime = datetime.datetime.now, trigger = "", trigger_exec = "", + timerFormat = "%Y-%m-%d %H:%M:%S.%f", tempTimer = True): self.name = name self.startTime = startTime self.endTime = endTime self.trigger = trigger self.trigger_exec = trigger_exec + self.timerFormat = timerFormat self.tempTimer = tempTimer # If enabled this will cause the Timer to be deleted upon shutdown or startup class Timers_Module(): def __init__(self): super().__init__() - self.timersList = [] + self.timersList = {} def main(self): - self.createTimer("test_timer", seconds=30) + self.createTimer("test_timer", seconds=15) + #self.createTimer("mega_test_timer", hours=20, seconds=10) #self.updateTimersList() + #for t in self.timersList: + #print(t) + + #while True: + #for t in self.timersList: + #print(t) + #print(self.checkTimerStatus_fromFiles("test_timer")) + #print(self.checkTimerStatus_fromFiles("test_timer_2")) + #time.sleep(0.5) + def updateTimersList(self): - self.compile_and_load() - - def compile_and_load(self): dic = {} implementations = self.get_implementations_dir() for dirName, subdirList, fileList in os.walk(implementations): for file in fileList: - name, startTime, endTime, trigger, trigger_exec, tempTimer = self.readFile(file) - newTimer = timer(name, startTime, endTime, trigger, trigger_exec, tempTimer) + print(file) + name, startTime, endTime, trigger, trigger_exec, timerFormat, tempTimer = self.readFile(file) + newTimer = timer( + name, + datetime.datetime.strptime(startTime, timerFormat), + datetime.datetime.strptime(endTime, timerFormat), + trigger, + trigger_exec, + utility.strToBool(tempTimer)) - dic[newTimer.name] = newTimer - self.timersList.append(self.timersList) - break + self.timersList[newTimer.name] = newTimer return dic + def get_base_dir(self) -> str: cwd = os.getcwd() split = os.path.split(cwd) @@ -64,25 +85,67 @@ class Timers_Module(): os.mkdir(path, 0x777) return path - def createTimer(self, name, days=0, hours=0, minutes=0, seconds=0, microseconds=0, trigger="", trigger_exec="", tempTimer=True): + def createTimer(self, name, days=0, hours=0, minutes=0, seconds=0, microseconds=0, trigger="", trigger_exec="", timerFormat='%Y-%m-%d %H:%M:%S.%f', tempTimer=True): startTime = datetime.datetime.now() targetTime = startTime + datetime.timedelta(days=days, hours=hours, minutes=minutes, seconds=seconds, microseconds=microseconds) - newTimer= timer(name, startTime, targetTime, trigger, trigger_exec, tempTimer) + newTimer= timer(name, startTime, targetTime, trigger, trigger_exec, timerFormat, tempTimer) - self.timersList.append(newTimer) + self.timersList[newTimer.name] = newTimer self.makeFile(newTimer) - def checkTimer(self, name): + def checkTimerStatus_fromFiles(self, name): + try: + if name is not None: + name, startTime, endTime, trigger, trigger_exec, timerFormat, tempTimer = self.readFile(name+".json") + if datetime.datetime.strptime(endTime, timerFormat) < datetime.datetime.now(): + #print("do timer thing") + #self.TIMER_EXEC(name, datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M:%S.%f'), datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M:%S.%f'), trigger, trigger_exec, utility.strToBool(tempTimer)) + return True + else: + return False + else: + return False + except: + return None - name, startTime, endTime, trigger, trigger_exec, tempTimer = self.readFile(name) - if endTime < datetime.datetime.now(): - print("do timer thing") - self.TIMER_EXEC(name, startTime, endTime, trigger, trigger_exec, tempTimer) + def checkTime_fromFiles(self, name): + try: + name, startTime, endTime, trigger, trigger_exec, timerFormat, tempTimer = self.readFile(name+".json") + if name is not None: + endT = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M:%S.%f') + if endT.timestamp() < datetime.datetime.now().timestamp(): + print("do timer thing") + endT = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M:%S.%f') + curTime = datetime.datetime.now() + #curTime = datetime.datetime.strptime(curTime, '%Y-%m-%d %H:%M:%S.%f') + result = endT - datetime.timedelta(days=curTime.day, hours=curTime.hour, minutes=curTime.minute, seconds=curTime.second, microseconds=curTime.microsecond) + print(type(result)) + #self.TIMER_EXEC(name, datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M:%S.%f'), datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M:%S.%f'), trigger, trigger_exec, utility.strToBool(tempTimer)) + fixedEndTime = datetime.datetime.strftime(result, '%M:%S') + return str("Did a thing") + else: + endT = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M:%S.%f') + curTime = str(datetime.datetime.now()) + curTime = datetime.datetime.strptime(curTime, '%Y-%m-%d %H:%M:%S.%f') + result = endT - datetime.timedelta(days=curTime.day, hours=curTime.hour, minutes=curTime.minute, seconds=curTime.second, microseconds=curTime.microsecond) + + fixedEndTime = datetime.datetime.strftime(result, '%M:%S') + #fixedTimeDelta = fixedEndTime - fixedCurTime + #praxis_logger.log(str(timeDelta)) + return str(fixedEndTime) + else: + return None + except: + return None def deleteTimer(self, name): - self.deleteFile(name) + try: + self.deleteFile(name+".json") + except: + print("Deletion Error") + self.timersList.pop(name) def TIMER_EXEC(self, name, startTime, endTime, trigger, trigger_exec, tempTimer): @@ -97,26 +160,27 @@ class Timers_Module(): dir = utility.get_dir("timers") script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in relative_path = timer_obj.name + ".json" - real_file_path = os.path.join(script_dir, relative_path) - with open(real_file_path, 'r+') as cred_r: - data = json.load(timer_obj) - data['name'] = timer_obj.name - data['startTime'] = timer_obj.startTime - data['endTime'] = timer_obj.endTime - data['trigger'] = timer_obj.trigger - data['trigger_exec'] = timer_obj.trigger_exec - data['tempTimer'] = timer_obj.tempTimer + real_file_path = os.path.join(script_dir, dir, relative_path) with open(real_file_path, 'w') as cred_w: - json.dump(data, cred_w, indent=2) + #data = json.load(timer_obj) + dic = {} + dic['name'] = timer_obj.name + dic['startTime'] = str(timer_obj.startTime) + dic['endTime'] = str(timer_obj.endTime) + dic['trigger'] = timer_obj.trigger + dic['trigger_exec'] = timer_obj.trigger_exec + dic['timerFormat'] = timer_obj.timerFormat + dic['tempTimer'] = str(timer_obj.tempTimer) + json.dump(dic, cred_w, indent=2) + def readFile(self, name): dir = utility.get_dir("timers") script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in relative_path = name #+ ".json" - real_file_path = os.path.join(script_dir, relative_path) + real_file_path = os.path.join(script_dir, dir, relative_path) - startTime, endTime, trigger, tempTimer = None with open(real_file_path, 'r') as cred_r: data = json.load(cred_r) name = data['name'] @@ -124,14 +188,15 @@ class Timers_Module(): endTime = data['endTime'] trigger = data['trigger'] trigger_exec = data['trigger_exec'] + timerFormat = data['timerFormat'] tempTimer = data['tempTimer'] - return name, startTime, endTime, trigger, trigger_exec, tempTimer + return name, startTime, endTime, trigger, trigger_exec, timerFormat, tempTimer def deleteFile(self, name): dir = utility.get_dir("timers") script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in relative_path = name #+ ".json" - real_file_path = os.path.join(script_dir, relative_path) + real_file_path = os.path.join(script_dir, dir, relative_path) os.remove(real_file_path) diff --git a/utilities_script.py b/utilities_script.py index 4cfb4d0..b79c4c0 100644 --- a/utilities_script.py +++ b/utilities_script.py @@ -40,6 +40,12 @@ def rescale_value(value, min, max): #print("got ", returnValue) return returnValue +def strToBool(stringToTest): + if stringToTest == "True": + return True + else: + return False + def get_dir(selected_dir): """ Checks for the tts directory, and will create it if it does not exist -- 2.45.2 From 8c7bc3e56bcf2906fc2c4ddf1d80e44a2201541c Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Wed, 5 May 2021 18:01:54 -0400 Subject: [PATCH 3/4] typo --- timers_module.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/timers_module.py b/timers_module.py index 22a2d97..22220ea 100644 --- a/timers_module.py +++ b/timers_module.py @@ -124,7 +124,7 @@ class Timers_Module(): #self.TIMER_EXEC(name, datetime.datetime.strptime(startTime, '%Y-%m-%d %H:%M:%S.%f'), datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M:%S.%f'), trigger, trigger_exec, utility.strToBool(tempTimer)) fixedEndTime = datetime.datetime.strftime(result, '%M:%S') - return str("Did a thing") + return str("Timer Done") else: endT = datetime.datetime.strptime(endTime, '%Y-%m-%d %H:%M:%S.%f') curTime = str(datetime.datetime.now()) -- 2.45.2 From c30decd0effa19925ca813de98234c49dc58be9e Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Thu, 6 May 2021 00:07:53 -0400 Subject: [PATCH 4/4] Port Changes --- channel_rewards/implemented/ChannelReward_Hydration.py | 4 ++-- .../implemented/ChannelReward_RubiksCube.py | 4 ++-- .../implemented/ChannelReward_SuggestPoll.py | 4 ++-- channel_rewards/implemented/ChannelReward_TTS.py | 4 ++-- .../implemented/ChannelReward_Workout_Pushups.py | 4 ++-- .../implemented/ChannelReward_Workout_Situps.py | 4 ++-- .../implemented/ChannelReward_Workout_Squats.py | 4 ++-- .../implemented/ChannelReward_twitchBits.py | 4 ++-- .../implemented/ChannelReward_twitchSubs.py | 4 ++-- commands/implemented/Command_chyron_v2.py | 2 +- commands/implemented/Command_lights_v2.py | 2 +- commands/implemented/Command_text_v2.py | 2 +- commands/implemented/Command_tts_v2.py | 4 ++-- docker-compose.yaml | 10 +++++----- standalone_channelrewards.py | 2 +- standalone_command.py | 2 +- standalone_discord_script.py | 6 +++--- standalone_lights.py | 2 +- standalone_obsWebSocket.py | 2 +- standalone_tts_core.py | 2 +- standalone_twitch_pubsub.py | 4 ++-- standalone_twitch_script.py | 6 +++--- standalone_webSource.py | 2 +- 23 files changed, 42 insertions(+), 42 deletions(-) diff --git a/channel_rewards/implemented/ChannelReward_Hydration.py b/channel_rewards/implemented/ChannelReward_Hydration.py index 3253b09..15b2990 100644 --- a/channel_rewards/implemented/ChannelReward_Hydration.py +++ b/channel_rewards/implemented/ChannelReward_Hydration.py @@ -56,7 +56,7 @@ class ChannelReward_Hydration(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -72,7 +72,7 @@ class ChannelReward_Hydration(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_RubiksCube.py b/channel_rewards/implemented/ChannelReward_RubiksCube.py index 920b775..ca16d79 100644 --- a/channel_rewards/implemented/ChannelReward_RubiksCube.py +++ b/channel_rewards/implemented/ChannelReward_RubiksCube.py @@ -47,7 +47,7 @@ class ChannelReward_RubiksCube(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -63,7 +63,7 @@ class ChannelReward_RubiksCube(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_SuggestPoll.py b/channel_rewards/implemented/ChannelReward_SuggestPoll.py index 932f737..74646b0 100644 --- a/channel_rewards/implemented/ChannelReward_SuggestPoll.py +++ b/channel_rewards/implemented/ChannelReward_SuggestPoll.py @@ -46,7 +46,7 @@ class ChannelReward_Suggest_Poll(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -62,7 +62,7 @@ class ChannelReward_Suggest_Poll(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_TTS.py b/channel_rewards/implemented/ChannelReward_TTS.py index 0255e85..da96ba9 100644 --- a/channel_rewards/implemented/ChannelReward_TTS.py +++ b/channel_rewards/implemented/ChannelReward_TTS.py @@ -46,7 +46,7 @@ class ChannelReward_TTS_Message(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -62,7 +62,7 @@ class ChannelReward_TTS_Message(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_Workout_Pushups.py b/channel_rewards/implemented/ChannelReward_Workout_Pushups.py index 1a8d9be..1d14afb 100644 --- a/channel_rewards/implemented/ChannelReward_Workout_Pushups.py +++ b/channel_rewards/implemented/ChannelReward_Workout_Pushups.py @@ -46,7 +46,7 @@ class ChannelReward_Workout_Pushups(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -62,7 +62,7 @@ class ChannelReward_Workout_Pushups(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_Workout_Situps.py b/channel_rewards/implemented/ChannelReward_Workout_Situps.py index 9cc08a2..557b9dc 100644 --- a/channel_rewards/implemented/ChannelReward_Workout_Situps.py +++ b/channel_rewards/implemented/ChannelReward_Workout_Situps.py @@ -46,7 +46,7 @@ class ChannelReward_Workout_Situps(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -62,7 +62,7 @@ class ChannelReward_Workout_Situps(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_Workout_Squats.py b/channel_rewards/implemented/ChannelReward_Workout_Squats.py index a814870..1173bc3 100644 --- a/channel_rewards/implemented/ChannelReward_Workout_Squats.py +++ b/channel_rewards/implemented/ChannelReward_Workout_Squats.py @@ -46,7 +46,7 @@ class ChannelReward_Workout_Squats(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -62,7 +62,7 @@ class ChannelReward_Workout_Squats(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_twitchBits.py b/channel_rewards/implemented/ChannelReward_twitchBits.py index f73e069..cbb455a 100644 --- a/channel_rewards/implemented/ChannelReward_twitchBits.py +++ b/channel_rewards/implemented/ChannelReward_twitchBits.py @@ -45,7 +45,7 @@ class ChannelReward_TwitchBits(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -61,7 +61,7 @@ class ChannelReward_TwitchBits(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/channel_rewards/implemented/ChannelReward_twitchSubs.py b/channel_rewards/implemented/ChannelReward_twitchSubs.py index 461d910..eabf2f9 100644 --- a/channel_rewards/implemented/ChannelReward_twitchSubs.py +++ b/channel_rewards/implemented/ChannelReward_twitchSubs.py @@ -46,7 +46,7 @@ class ChannelReward_TwitchSubs(AbstractChannelRewards, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -62,7 +62,7 @@ class ChannelReward_TwitchSubs(AbstractChannelRewards, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/commands/implemented/Command_chyron_v2.py b/commands/implemented/Command_chyron_v2.py index a9f779c..6b47d4c 100644 --- a/commands/implemented/Command_chyron_v2.py +++ b/commands/implemented/Command_chyron_v2.py @@ -57,7 +57,7 @@ class Command_chyron_v2(AbstractCommand, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/commands/implemented/Command_lights_v2.py b/commands/implemented/Command_lights_v2.py index 7243a6e..1b28a6c 100644 --- a/commands/implemented/Command_lights_v2.py +++ b/commands/implemented/Command_lights_v2.py @@ -47,7 +47,7 @@ class Command_lights_v2(AbstractCommand, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/commands/implemented/Command_text_v2.py b/commands/implemented/Command_text_v2.py index fd0683e..e3109a6 100644 --- a/commands/implemented/Command_text_v2.py +++ b/commands/implemented/Command_text_v2.py @@ -107,7 +107,7 @@ class Command_Text_v2(AbstractCommand, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/commands/implemented/Command_tts_v2.py b/commands/implemented/Command_tts_v2.py index f2f69b5..93e667b 100644 --- a/commands/implemented/Command_tts_v2.py +++ b/commands/implemented/Command_tts_v2.py @@ -67,7 +67,7 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta): # todo need to url-escape command and rest params = urlencode({'user_name': username, 'light_group': light_group, 'command': command, 'rest':rest}) #standalone_lights - url = "http://standalone_lights:42069/api/v1/exec_lights?%s" % params + url = "http://standalone_lights:42042/api/v1/exec_lights?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -83,7 +83,7 @@ class Command_tts_v2(AbstractCommand, metaclass=ABCMeta): def send_TTS(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/docker-compose.yaml b/docker-compose.yaml index c2f18d4..93dfe70 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -5,7 +5,7 @@ services: volumes: - "./:/Praxis/" ports: - - 6009:6009 + - 42010:42010 environment: - ISDOCKER=cat standalone_channelrewards: @@ -13,7 +13,7 @@ services: volumes: - "./:/Praxis/" ports: - - 6969:6969 + - 42069:42069 environment: - ISDOCKER=cat standalone_lights: @@ -21,7 +21,7 @@ services: volumes: - "./:/Praxis/" ports: - - 42069:42069 + - 42042:42042 environment: - ISDOCKER=cat standalone_tts_core: @@ -29,7 +29,7 @@ services: volumes: - "./:/Praxis/" ports: - - 60809:60809 + - 42064:42064 environment: - ISDOCKER=cat standalone_websource: @@ -37,7 +37,7 @@ services: volumes: - "./:/Praxis/" ports: - - 5500:5500 + - 42088:42088 environment: - ISDOCKER=cat standalone_twitchscript: diff --git a/standalone_channelrewards.py b/standalone_channelrewards.py index 64b9219..7b58718 100644 --- a/standalone_channelrewards.py +++ b/standalone_channelrewards.py @@ -110,4 +110,4 @@ def exec_reward(): if __name__ == '__main__': init() - api.run(host='0.0.0.0', port=6969) + api.run(host='0.0.0.0', port=42069) diff --git a/standalone_command.py b/standalone_command.py index 5333510..934f1f2 100644 --- a/standalone_command.py +++ b/standalone_command.py @@ -83,4 +83,4 @@ def exec_command(): if __name__ == '__main__': init() - api.run(host='0.0.0.0', port=6009) + api.run(host='0.0.0.0', port=42010) diff --git a/standalone_discord_script.py b/standalone_discord_script.py index 52378bb..861ed19 100644 --- a/standalone_discord_script.py +++ b/standalone_discord_script.py @@ -105,7 +105,7 @@ class Discord_Module(discord.Client): async def is_command(self, word: str) -> bool: # todo need to url-escape word clean_param = urlencode({'name': word}) - url = "http://standalone_command:6009/api/v1/command?%s" % clean_param + url = "http://standalone_command:42010/api/v1/command?%s" % clean_param resp = requests.get(url) return resp.status_code == 200 @@ -118,7 +118,7 @@ class Discord_Module(discord.Client): 'rest': rest, 'bonus_data': realMessage}) - url = "http://standalone_command:6009/api/v1/exec_command?%s" % params + url = "http://standalone_command:42010/api/v1/exec_command?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -180,7 +180,7 @@ class Discord_Module(discord.Client): async def exec_tts_sender(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/standalone_lights.py b/standalone_lights.py index 2e26541..294be50 100644 --- a/standalone_lights.py +++ b/standalone_lights.py @@ -302,5 +302,5 @@ def exec_lights(): if __name__ == "__main__": init() - api.run(host='0.0.0.0', port=42069) + api.run(host='0.0.0.0', port=42042) #testModule.raveMode() \ No newline at end of file diff --git a/standalone_obsWebSocket.py b/standalone_obsWebSocket.py index 553b216..68f6e16 100644 --- a/standalone_obsWebSocket.py +++ b/standalone_obsWebSocket.py @@ -42,4 +42,4 @@ def makeRequest(): if __name__ == "__main__": init() - api.run(host='0.0.0.0', port=6009) \ No newline at end of file + api.run(host='0.0.0.0', port=42010) \ No newline at end of file diff --git a/standalone_tts_core.py b/standalone_tts_core.py index aa45804..5b51020 100644 --- a/standalone_tts_core.py +++ b/standalone_tts_core.py @@ -51,4 +51,4 @@ def tts_send_text(): if __name__ == '__main__': #send_text("","Blah Blah Blah") #init() - api.run(host='0.0.0.0', port=60809) \ No newline at end of file + api.run(host='0.0.0.0', port=42064) \ No newline at end of file diff --git a/standalone_twitch_pubsub.py b/standalone_twitch_pubsub.py index ba1a1b2..00753dc 100644 --- a/standalone_twitch_pubsub.py +++ b/standalone_twitch_pubsub.py @@ -171,7 +171,7 @@ class Twitch_Pubsub(): clean_param = urlencode({'reward_name': rewardName, 'reward_type':rewardType}) print(rewardName, rewardType) #standalone_channelrewards - url = "http://standalone_channelrewards:6969/api/v1/reward?%s" % clean_param + url = "http://standalone_channelrewards:42069/api/v1/reward?%s" % clean_param resp = requests.get(url) return resp.status_code == 200 @@ -186,7 +186,7 @@ class Twitch_Pubsub(): 'bonus_data': realMessage}) #standalone_channelrewards - url = "http://standalone_channelrewards:6969/api/v1/exec_reward?%s" % params + url = "http://standalone_channelrewards:42069/api/v1/exec_reward?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/standalone_twitch_script.py b/standalone_twitch_script.py index 78c3215..d83551c 100644 --- a/standalone_twitch_script.py +++ b/standalone_twitch_script.py @@ -83,7 +83,7 @@ class Twitch_Module(): def is_command(self, word: str) -> bool: # todo need to url-escape word clean_param = urlencode({'name': word}) - url = "http://standalone_command:6009/api/v1/command?%s" % clean_param + url = "http://standalone_command:42010/api/v1/command?%s" % clean_param resp = requests.get(url) return resp.status_code == 200 @@ -96,7 +96,7 @@ class Twitch_Module(): 'rest': rest, 'bonus_data': realMessage}) - url = "http://standalone_command:6009/api/v1/exec_command?%s" % params + url = "http://standalone_command:42010/api/v1/exec_command?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) @@ -134,7 +134,7 @@ class Twitch_Module(): def exec_tts_sender(self, username, message): params = urlencode({'tts_sender': username, 'tts_text': message}) #standalone_tts_core - url = "http://standalone_tts_core:60809/api/v1/tts/send_text?%s" % params + url = "http://standalone_tts_core:42064/api/v1/tts/send_text?%s" % params resp = requests.get(url) if resp.status_code == 200: print("Got the following message: %s" % resp.text) diff --git a/standalone_webSource.py b/standalone_webSource.py index 31fcf2d..040c38e 100644 --- a/standalone_webSource.py +++ b/standalone_webSource.py @@ -63,4 +63,4 @@ def textSource_timerTime(timer_name): if __name__ == "__main__": init() - api.run(host="0.0.0.0", port = 5500) \ No newline at end of file + api.run(host="0.0.0.0", port = 42088) \ No newline at end of file -- 2.45.2