Chyron Auto Fix

Improved the command in respects to the chyron command min length.
This commit is contained in:
Alex Orid 2021-04-30 15:03:22 -04:00
parent 260d7f44f2
commit 1c3d973edf

View File

@ -31,7 +31,7 @@ class Command_Text_v2(AbstractCommand, metaclass=ABCMeta):
def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None): def do_command(self, source = AbstractCommand.CommandSource.default, user = "User", command = "", rest = "", bonusData = None):
returnString = "trying to update text..." returnString = "trying to update text..."
praxis_logger_obj.log("\n Command>: " + command + " " + rest) praxis_logger_obj.log("\n Command>: " + command + " " + rest)
returnString = user + " has attempted to update the text but an error may have occurred!"
for name in config.adminUsers_List: for name in config.adminUsers_List:
print(name) print(name)
tempName = user.lower() tempName = user.lower()
@ -68,12 +68,33 @@ class Command_Text_v2(AbstractCommand, metaclass=ABCMeta):
tempText.itemName = tempParsedMessage[2] tempText.itemName = tempParsedMessage[2]
tempText.itemContent = newText tempText.itemContent = newText
tempTextModule.makeItem(tempText) tempTextModule.makeItem(tempText)
returnString = user + " has updated the text!"
else:
returnString = user + " has attempted to update the text but an error may have occurred!"
#tempTextModule.update_tempTextFiles()
if "chyron" in tempParsedMessage[1]:
tempTextModule:tempText_Module.tempText_Module = tempText_Module.tempText_Module()
tempText:tempText_Module.tempTextItem = tempText_Module.tempTextItem()
if i > 1:
newText = ""
counter = 0
for word in tempParsedMessage:
if counter > 1:
newText = newText + word + " "
counter = counter + 1
newText = newText[:-1] # Gets rid of last space
#print(tempParsedMessage[2], newText)
tempText.itemName = tempParsedMessage[1]
if len(newText) < 120:
for x in range(120-len(newText)):
newText = newText + " "
tempText.itemContent = newText
tempTextModule.makeItem(tempText)
returnString = user + " has updated the chyron text!"
else: else:
returnString = user + " has attempted to update the text but an error may have occurred!" returnString = user + " has attempted to update the text but an error may have occurred!"
#tempTextModule.update_tempTextFiles() #tempTextModule.update_tempTextFiles()
returnMessage = user + " has updated the text!"
returnString = returnMessage