chyron file creation

This commit is contained in:
Alex Orid 2021-04-09 17:33:06 -04:00
parent 684b22f451
commit 974385242f

View File

@ -1,5 +1,6 @@
import config import config
import utilities_script as utilities import utilities_script as utilities
import os
class Chyron_Module(): class Chyron_Module():
def __init__(self): def __init__(self):
@ -15,6 +16,7 @@ class Chyron_Module():
for x in range(config.chyronListSpaceCount): for x in range(config.chyronListSpaceCount):
newString = newString + " " newString = newString + " "
self.chyron_computedString = newString self.chyron_computedString = newString
return newString
def addItem(self, name, title, content): def addItem(self, name, title, content):
newItem:ChyronItem = ChyronItem() newItem:ChyronItem = ChyronItem()
@ -28,6 +30,14 @@ class Chyron_Module():
def updateChyronFile(self): def updateChyronFile(self):
dir = utilities.get_dir("stream_sources") 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(): class ChyronItem():
@ -89,4 +99,6 @@ if __name__ == "__main__":
testModule.chyron_stringUpdater() testModule.chyron_stringUpdater()
test = testModule.chyron_computedString + "<<<|" test = testModule.chyron_computedString + "<<<|"
print(test) print(test)
testModule.updateChyronFile()