From 974385242f4ebfd6adf040e02f1cbd037434b12c Mon Sep 17 00:00:00 2001 From: Alex Orid Date: Fri, 9 Apr 2021 17:33:06 -0400 Subject: [PATCH] chyron file creation --- chyron_module.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/chyron_module.py b/chyron_module.py index 2e6e842..dfcc559 100644 --- a/chyron_module.py +++ b/chyron_module.py @@ -1,5 +1,6 @@ import config import utilities_script as utilities +import os class Chyron_Module(): def __init__(self): @@ -15,6 +16,7 @@ class Chyron_Module(): for x in range(config.chyronListSpaceCount): newString = newString + " " self.chyron_computedString = newString + return newString def addItem(self, name, title, content): newItem:ChyronItem = ChyronItem() @@ -28,6 +30,14 @@ class Chyron_Module(): def updateChyronFile(self): dir = utilities.get_dir("stream_sources") + script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in + relative_path = "stream_sources/chyron.txt" + real_file_path = os.path.join(script_dir, relative_path) + + file = open(real_file_path, "wb") + chyron = self.chyron_stringUpdater().encode("utf8") + file.write(chyron) + file.close class ChyronItem(): @@ -89,4 +99,6 @@ if __name__ == "__main__": testModule.chyron_stringUpdater() test = testModule.chyron_computedString + "<<<|" - print(test) \ No newline at end of file + print(test) + + testModule.updateChyronFile() \ No newline at end of file