1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 08:26:57 -05:00
fHDHR_NextPVR/fHDHR_web/api/startup_tasks.py
2020-12-18 08:54:07 -05:00

35 lines
1.0 KiB
Python

class Startup_Tasks():
endpoints = ["/api/startup_tasks"]
endpoint_name = "api_startup_tasks"
endpoint_methods = ["GET", "POST"]
def __init__(self, fhdhr):
self.fhdhr = fhdhr
self.epg_update_url = "%s/api/epg?method=update" % (self.fhdhr.api.base)
self.channel_update_url = "%s/api/channels?method=scan" % (self.fhdhr.api.base)
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(self.channel_update_url)
# Hit EPG Update API
for epg_method in self.fhdhr.device.epg.epg_methods:
self.fhdhr.api.client.get("%s?sorurce=%s" % (self.epg_update_url, epg_method))
return "Success"