fHDHR_STIRR/fHDHR_web/api/startup_tasks.py
deathbybandaid f5514fd41c test
2020-12-16 09:41:02 -05:00

31 lines
817 B
Python

class Startup_Tasks():
endpoints = ["/api/startup_tasks"]
endpoint_name = "api_startup_tasks"
endpoint_methods = ["GET", "POST"]
def __init__(self, fhdhr):
self.fhdhr = fhdhr
def __call__(self, *args):
return self.get(*args)
def get(self, *args):
# Hit Channel Update API
haseverscanned = self.fhdhr.db.get_fhdhr_value("channels", "scanned_time")
updatechannels = False
if not haseverscanned:
updatechannels = True
elif self.fhdhr.config.dict["fhdhr"]["chanscan_on_start"]:
updatechannels = True
if updatechannels:
self.fhdhr.api.client.get("/api/channels?method=scan")
# Hit EPG Update API
self.fhdhr.api.client.get("/api/epg?method=update")
return "Success"