run all jobs on start

This commit is contained in:
deflax 2024-01-06 06:15:53 +02:00
parent e07261deed
commit 0f713cdc53

View file

@ -15,6 +15,9 @@ logger.setLevel(os.environ.get('SCHEDULER_LOG_LEVEL', 'INFO').upper())
database = {} database = {}
prio = 0 prio = 0
head = {} head = {}
with open('/config/epg.json', 'r') as json_file:
# Load the epg.json config file
epg_json = json.load(json_file)
# Environment # Environment
api_hostname = os.environ.get('CORE_API_HOSTNAME') api_hostname = os.environ.get('CORE_API_HOSTNAME')
@ -52,11 +55,6 @@ def find_event_entry(events, target_name):
if "name" in entry and entry["name"] == target_name: if "name" in entry and entry["name"] == target_name:
return {"start_at": entry.get("start_at"), "prio": entry.get("prio")} return {"start_at": entry.get("start_at"), "prio": entry.get("prio")}
return None return None
# Load the epg.json config file
with open('/config/epg.json', 'r') as json_file:
# Load the JSON data from the file
epg_json = json.load(json_file)
def stream_exec(stream_name, stream_prio, stream_hls_url): def stream_exec(stream_name, stream_prio, stream_hls_url):
global head global head
@ -163,6 +161,8 @@ schedule.every(SYNC_PERIOD).minutes.do(core_api_sync)
schedule.every().minute.do(show_database) schedule.every().minute.do(show_database)
schedule.every().minute.do(show_scheduled_tasks) schedule.every().minute.do(show_scheduled_tasks)
schedule.run_all()
@app.route('/', methods=['GET']) @app.route('/', methods=['GET'])
def root_query(): def root_query():
global head global head