1
0
mirror of https://github.com/fHDHR/fHDHR_NextPVR.git synced 2025-12-06 10:26: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,12 +70,19 @@ class Channels():
updatelist = True updatelist = True
if updatelist: 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.") self.fhdhr.logger.info("Performing Channel Scan.")
channel_dict_list = self.origin.get_channels() channel_dict_list = self.origin.get_channels()
for channel_info in channel_dict_list: for channel_info in channel_dict_list:
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_obj = Channel(self.fhdhr, self.id_system, origin_id=channel_info["id"])
channel_id = channel_obj.dict["id"] channel_id = channel_obj.dict["id"]
channel_obj.basics(channel_info) channel_obj.basics(channel_info)
if not chan_existing:
self.list[channel_id] = channel_obj self.list[channel_id] = channel_obj
if not self.list_update_time: if not self.list_update_time:

View File

@ -36,6 +36,13 @@ class EPG():
if epg_method not in list(self.sleeptime.keys()): if epg_method not in list(self.sleeptime.keys()):
self.sleeptime[epg_method] = self.fhdhr.config.dict["epg"]["update_frequency"] 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): def clear_epg_cache(self, method=None):
if not method: if not method:
@ -178,12 +185,12 @@ class EPG():
def run(self): def run(self):
for epg_method in self.epg_methods: for epg_method in self.epg_methods:
self.update(epg_method) self.fhdhr.web.session.get(self.epg_update_url)
try: try:
while True: while True:
for epg_method in self.epg_methods: for epg_method in self.epg_methods:
if time.time() >= (self.fhdhr.db.get_fhdhr_value("update_time", epg_method) + self.sleeptime[epg_method]): if time.time() >= (self.fhdhr.db.get_fhdhr_value("update_time", epg_method) + self.sleeptime[epg_method]):
self.update(epg_method) self.fhdhr.web.session.get(self.epg_update_url)
time.sleep(3600) time.sleep(360)
except KeyboardInterrupt: except KeyboardInterrupt:
pass pass