1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 06:56:57 -05:00

More Enhancements

This commit is contained in:
deathbybandaid 2020-12-07 16:20:08 -05:00
parent b8b39915dc
commit 396a826d98
2 changed files with 19 additions and 5 deletions

View File

@ -70,13 +70,20 @@ class Channels():
updatelist = True
if updatelist:
channel_origin_id_list = [str(self.list[x].dict["origin_id"]) for x in list(self.list.keys())]
self.fhdhr.logger.info("Performing Channel Scan.")
channel_dict_list = self.origin.get_channels()
for channel_info in channel_dict_list:
channel_obj = Channel(self.fhdhr, self.id_system, origin_id=channel_info["id"])
chan_existing = False
if str(channel_info["id"]) in channel_origin_id_list:
chan_existing = True
channel_obj = self.get_channel_obj("origin_id", channel_info["id"])
else:
channel_obj = Channel(self.fhdhr, self.id_system, origin_id=channel_info["id"])
channel_id = channel_obj.dict["id"]
channel_obj.basics(channel_info)
self.list[channel_id] = channel_obj
if not chan_existing:
self.list[channel_id] = channel_obj
if not self.list_update_time:
self.fhdhr.logger.info("Found " + str(len(self.list)) + " channels for " + str(self.fhdhr.config.dict["main"]["servicename"]))

View File

@ -36,6 +36,13 @@ class EPG():
if epg_method not in list(self.sleeptime.keys()):
self.sleeptime[epg_method] = self.fhdhr.config.dict["epg"]["update_frequency"]
if self.fhdhr.config.dict["fhdhr"]["address"] == "0.0.0.0":
self.location = ('http://127.0.0.1:%s' % str(self.fhdhr.config.dict["fhdhr"]["port"]))
else:
self.location = ('http://%s:%s' % (self.fhdhr.config.dict["fhdhr"]["address"], str(self.fhdhr.config.dict["fhdhr"]["port"])))
self.epg_update_url = "%s/api/epg?method=update" % (self.location)
def clear_epg_cache(self, method=None):
if not method:
@ -178,12 +185,12 @@ class EPG():
def run(self):
for epg_method in self.epg_methods:
self.update(epg_method)
self.fhdhr.web.session.get(self.epg_update_url)
try:
while True:
for epg_method in self.epg_methods:
if time.time() >= (self.fhdhr.db.get_fhdhr_value("update_time", epg_method) + self.sleeptime[epg_method]):
self.update(epg_method)
time.sleep(3600)
self.fhdhr.web.session.get(self.epg_update_url)
time.sleep(360)
except KeyboardInterrupt:
pass