From 0e2da8413846ddb35b35ccfc26f9097ec07f9038 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 16 Dec 2020 08:27:51 -0500 Subject: [PATCH] EPG Update Bugfix --- fHDHR/device/epg/__init__.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/fHDHR/device/epg/__init__.py b/fHDHR/device/epg/__init__.py index a7b1ea0..0ad4575 100644 --- a/fHDHR/device/epg/__init__.py +++ b/fHDHR/device/epg/__init__.py @@ -296,10 +296,18 @@ class EPG(): while True: for epg_method in self.epg_methods: last_update_time = self.fhdhr.db.get_fhdhr_value("update_time", epg_method) + updatetheepg = False if not last_update_time: - self.fhdhr.web.session.get(self.epg_update_url) + updatetheepg = True elif time.time() >= (last_update_time + self.sleeptime[epg_method]): - self.fhdhr.web.session.get(self.epg_update_url) - time.sleep(360) + updatetheepg = True + if updatetheepg: + try: + self.fhdhr.web.session.get(self.epg_update_url, timeout=0.0000000001) + except self.fhdhr.web.exceptions.ReadTimeout: + pass + except self.fhdhr.web.exceptions.ConnectionError as e: + self.fhdhr.logger.error("Error updating %s EPG cache: %s" % (epg_method, e)) + time.sleep(1800) except KeyboardInterrupt: pass