Added Flask Module
This commit is contained in:
parent
4e18983c45
commit
97ded4d153
1
.gitignore
vendored
1
.gitignore
vendored
@ -4,3 +4,4 @@ __pycache__/
|
|||||||
credentials/
|
credentials/
|
||||||
.idea/
|
.idea/
|
||||||
stream_sources/chyron.txt
|
stream_sources/chyron.txt
|
||||||
|
stream_sources/brb.txt
|
||||||
|
|||||||
@ -69,6 +69,18 @@ class Chyron_Module():
|
|||||||
file.write(chyron)
|
file.write(chyron)
|
||||||
file.close
|
file.close
|
||||||
|
|
||||||
|
def getChyronFile(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, "rb")
|
||||||
|
text = file.read()
|
||||||
|
#print(text)
|
||||||
|
file.close
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
class ChyronItem():
|
class ChyronItem():
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
|||||||
@ -49,6 +49,17 @@ class tempText_Module():
|
|||||||
file.write(itemText_)
|
file.write(itemText_)
|
||||||
file.close
|
file.close
|
||||||
|
|
||||||
|
def getTempTextFile(self, key):
|
||||||
|
dir = utilities.get_dir("stream_sources")
|
||||||
|
script_dir = os.path.dirname(__file__) #<-- absolute dir the script is in
|
||||||
|
relative_path = "stream_sources/" + key + ".txt"
|
||||||
|
real_file_path = os.path.join(script_dir, relative_path)
|
||||||
|
|
||||||
|
file = open(real_file_path, "rb")
|
||||||
|
text = file.read()
|
||||||
|
#print(text)
|
||||||
|
file.close
|
||||||
|
return text
|
||||||
|
|
||||||
|
|
||||||
class tempTextItem():
|
class tempTextItem():
|
||||||
|
|||||||
55
webSource_module.py
Normal file
55
webSource_module.py
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
from enum import Enum
|
||||||
|
from os import F_OK
|
||||||
|
import tempText_Module
|
||||||
|
import time
|
||||||
|
import config as config
|
||||||
|
import db
|
||||||
|
import tts
|
||||||
|
|
||||||
|
from flask import Flask
|
||||||
|
|
||||||
|
import credentials
|
||||||
|
|
||||||
|
import commands.loader as command_loader
|
||||||
|
from commands.command_base import AbstractCommand
|
||||||
|
|
||||||
|
from cooldowns import Cooldown_Module
|
||||||
|
|
||||||
|
import utilities_script as utility
|
||||||
|
|
||||||
|
import chyron_module
|
||||||
|
|
||||||
|
class webSource_Module():
|
||||||
|
webSources:Flask = Flask('webSources')
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super().__init__()
|
||||||
|
self.dbCredential: credentials.DB_Credential
|
||||||
|
|
||||||
|
def main(self):
|
||||||
|
self.webSources.run(host="0.0.0.0")
|
||||||
|
|
||||||
|
@webSources.route('/')
|
||||||
|
def hello_world():
|
||||||
|
return 'I can see your Ghost!'
|
||||||
|
|
||||||
|
@webSources.route('/chyron')
|
||||||
|
def textSource_chyron():
|
||||||
|
tempModule = chyron_module.Chyron_Module()
|
||||||
|
return tempModule.getChyronFile()
|
||||||
|
|
||||||
|
@webSources.route('/' + 'brb')
|
||||||
|
def textSource_tempText():
|
||||||
|
tempModule = tempText_Module.tempText_Module()
|
||||||
|
return tempModule.getTempTextFile("brb")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
testModule = webSource_Module()
|
||||||
|
|
||||||
|
credentials_manager = credentials.Credentials_Module()
|
||||||
|
credentials_manager.load_credentials()
|
||||||
|
testModule.dbCredential = credentials_manager.find_DB_Credential(config.credentialsNickname)
|
||||||
|
|
||||||
|
testModule.main()
|
||||||
Loading…
Reference in New Issue
Block a user