logging
This commit is contained in:
parent
8dd069f7b9
commit
6905e211c7
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,4 +5,5 @@ credentials/
|
||||
.idea/
|
||||
stream_sources/chyron.txt
|
||||
stream_sources/brb.txt
|
||||
*.log
|
||||
*.log
|
||||
*.log
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
from abc import ABCMeta
|
||||
|
||||
import lights_module
|
||||
from commands.command_base import AbstractCommand
|
||||
|
||||
import utilities_script as utility
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
import requests
|
||||
|
||||
class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
|
||||
"""
|
||||
@ -20,56 +21,26 @@ class Command_lights_v2(AbstractCommand, metaclass=ABCMeta):
|
||||
def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None):
|
||||
returnString = ""
|
||||
|
||||
tempBool = True
|
||||
if tempBool == True:
|
||||
LightModule = lights_module.Lights_Module()
|
||||
LightModule.main()
|
||||
#bot.return_message("\nRGB Command Detected!")
|
||||
tempFix = command + " " + rest
|
||||
|
||||
tempParsedMessage = tempFix.split(" ")
|
||||
sceneCommand = False
|
||||
if (len(tempParsedMessage)) > 2:
|
||||
#bot.return_message("RGB Command!")
|
||||
rgb_r = float(tempParsedMessage[1])
|
||||
rgb_g = float(tempParsedMessage[2])
|
||||
rgb_b = float(tempParsedMessage[3])
|
||||
xy_result = LightModule.rgb_to_xy(rgb_r, rgb_g, rgb_b)
|
||||
#bot.return_message("got XY")
|
||||
LightModule.bridge_.set_group(16, "xy", xy_result)
|
||||
#bot.return_message("sent color to [Lights_Module]")
|
||||
else:
|
||||
if "stream" in tempParsedMessage:
|
||||
sceneCommand = True
|
||||
LightModule.bridge_.run_scene("Downstairs", "Stream")
|
||||
elif "normal" in tempParsedMessage:
|
||||
sceneCommand = True
|
||||
LightModule.bridge_.run_scene("Downstairs", "Bright")
|
||||
elif "haxor" in tempParsedMessage:
|
||||
sceneCommand = True
|
||||
LightModule.bridge_.run_scene("Downstairs", "hacker vibes")
|
||||
elif "off" in tempParsedMessage:
|
||||
sceneCommand = True
|
||||
LightModule.bridge_.set_group("Downstairs", "on", False)
|
||||
elif "on" in tempParsedMessage:
|
||||
sceneCommand = True
|
||||
LightModule.bridge_.set_group("Downstairs", "on", True)
|
||||
elif "ravemode" in tempParsedMessage:
|
||||
sceneCommand = True
|
||||
LightModule.raveMode()
|
||||
else:
|
||||
#bot.return_message("Color Command!")
|
||||
xy_result = LightModule.color_string_parser(tempParsedMessage)
|
||||
#bot.return_message("got XY")
|
||||
LightModule.bridge_.set_group(16, "xy", xy_result)
|
||||
#bot.return_message("sent color to [Lights_Module]")
|
||||
|
||||
#if sceneCommand == True:
|
||||
#bot.return_message("Scene Command!")
|
||||
|
||||
returnString = user + " changed the light's color!"
|
||||
returnString = self.dothething(user, 16, "!lights hydration", "")
|
||||
|
||||
return returnString
|
||||
|
||||
def dothething(self, username, light_group, command, rest):
|
||||
# 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
|
||||
resp = requests.get(url)
|
||||
if resp.status_code == 200:
|
||||
print("Got the following message: %s" % resp.text)
|
||||
data = loads(resp.text)
|
||||
msg = data['message']
|
||||
if msg is not None:
|
||||
return msg
|
||||
# todo send to logger and other relevent services
|
||||
else:
|
||||
# todo handle failed requests
|
||||
pass
|
||||
|
||||
def get_help(self):
|
||||
return self.help
|
||||
@ -10,3 +10,29 @@ INFO:root:init stuff
|
||||
WARNING:werkzeug: * Debugger is active!
|
||||
INFO:werkzeug: * Debugger PIN: 760-498-562
|
||||
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
||||
INFO:root:Application running!
|
||||
INFO:root:
|
||||
-Starting Logs: standalone_channelrewards.py
|
||||
INFO:root:init stuff
|
||||
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
||||
INFO:werkzeug: * Restarting with stat
|
||||
INFO:root:Application running!
|
||||
INFO:root:
|
||||
-Starting Logs: standalone_channelrewards.py
|
||||
INFO:root:init stuff
|
||||
WARNING:werkzeug: * Debugger is active!
|
||||
INFO:werkzeug: * Debugger PIN: 758-762-350
|
||||
INFO:root:Application running!
|
||||
INFO:root:
|
||||
-Starting Logs: standalone_channelrewards.py
|
||||
INFO:root:init stuff
|
||||
INFO:werkzeug: * Running on http://0.0.0.0:6969/ (Press CTRL+C to quit)
|
||||
INFO:werkzeug: * Restarting with stat
|
||||
INFO:root:Application running!
|
||||
INFO:root:
|
||||
-Starting Logs: standalone_channelrewards.py
|
||||
INFO:root:init stuff
|
||||
WARNING:werkzeug: * Debugger is active!
|
||||
INFO:werkzeug: * Debugger PIN: 181-543-254
|
||||
INFO:werkzeug:192.168.48.7 - - [28/Apr/2021 04:44:07] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||
INFO:werkzeug:192.168.48.7 - - [28/Apr/2021 04:44:13] "[35m[1mGET /api/v1/reward?reward_name=Hydrate&reward_type=ChannelRewardsType.channelPoints HTTP/1.1[0m" 500 -
|
||||
|
||||
@ -11,11 +11,16 @@ import config
|
||||
import flask
|
||||
from flask import request
|
||||
|
||||
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__)
|
||||
# enable/disable this to get web pages of crashes returned
|
||||
api.config["DEBUG"] = True
|
||||
|
||||
|
||||
class Lights_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
@ -73,7 +78,7 @@ class Lights_Module():
|
||||
# This will set the group Downstairs to the Stream scene
|
||||
#self.bridge_.run_scene("Downstairs", "Stream")
|
||||
|
||||
self.bridge_.run_scene("Downstairs", "Stream")
|
||||
#self.bridge_.run_scene("Downstairs", "Stream")
|
||||
print("-[Lights_Module] Setup Complete")
|
||||
|
||||
def setLight():
|
||||
|
||||
@ -20,6 +20,12 @@ from uuid import UUID
|
||||
|
||||
from cooldowns import Cooldown_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__))
|
||||
|
||||
class Twitch_Pubsub():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
@ -12,6 +12,12 @@ from cooldowns import Cooldown_Module
|
||||
import commands.command_base
|
||||
import utilities_script as utility
|
||||
|
||||
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__))
|
||||
|
||||
class Twitch_Module():
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user