From 8b870430ad5f1b3a078d819e80d81929a1cfec35 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Wed, 9 Dec 2020 16:26:43 -0500 Subject: [PATCH] Update EPG Directory Structure --- alternative_epg/{tvtv.py => tvtv/__init__.py} | 0 alternative_epg/{ => tvtv}/tvtv_conf.json | 0 alternative_epg/{zap2it.py => zap2it/__init__.py} | 0 alternative_epg/{ => zap2it}/zap2it_conf.json | 0 fHDHR/config/__init__.py | 12 +++++++++--- fHDHR/device/epg/__init__.py | 3 +++ 6 files changed, 12 insertions(+), 3 deletions(-) rename alternative_epg/{tvtv.py => tvtv/__init__.py} (100%) rename alternative_epg/{ => tvtv}/tvtv_conf.json (100%) rename alternative_epg/{zap2it.py => zap2it/__init__.py} (100%) rename alternative_epg/{ => zap2it}/zap2it_conf.json (100%) diff --git a/alternative_epg/tvtv.py b/alternative_epg/tvtv/__init__.py similarity index 100% rename from alternative_epg/tvtv.py rename to alternative_epg/tvtv/__init__.py diff --git a/alternative_epg/tvtv_conf.json b/alternative_epg/tvtv/tvtv_conf.json similarity index 100% rename from alternative_epg/tvtv_conf.json rename to alternative_epg/tvtv/tvtv_conf.json diff --git a/alternative_epg/zap2it.py b/alternative_epg/zap2it/__init__.py similarity index 100% rename from alternative_epg/zap2it.py rename to alternative_epg/zap2it/__init__.py diff --git a/alternative_epg/zap2it_conf.json b/alternative_epg/zap2it/zap2it_conf.json similarity index 100% rename from alternative_epg/zap2it_conf.json rename to alternative_epg/zap2it/zap2it_conf.json diff --git a/fHDHR/config/__init__.py b/fHDHR/config/__init__.py index cd4fd7b..1921cf7 100644 --- a/fHDHR/config/__init__.py +++ b/fHDHR/config/__init__.py @@ -53,9 +53,15 @@ class Config(): for dir_type in ["alternative_epg", "origin"]: for file_item in os.listdir(self.internal["paths"][dir_type]): - file_item_path = os.path.join(self.internal["paths"][dir_type], file_item) - if str(file_item_path).endswith("_conf.json"): - self.read_json_config(file_item_path) + file_item_path = pathlib.Path(self.internal["paths"][dir_type]).joinpath(file_item) + if file_item_path.is_dir(): + for sub_file_item in os.listdir(file_item_path): + sub_file_item_path = pathlib.Path(file_item_path).joinpath(sub_file_item) + if str(sub_file_item_path).endswith("_conf.json"): + self.read_json_config(sub_file_item_path) + else: + if str(file_item_path).endswith("_conf.json"): + self.read_json_config(file_item_path) print("Loading Configuration File: " + str(self.config_file)) self.read_ini_config(self.config_file) diff --git a/fHDHR/device/epg/__init__.py b/fHDHR/device/epg/__init__.py index b519727..9f5a8f8 100644 --- a/fHDHR/device/epg/__init__.py +++ b/fHDHR/device/epg/__init__.py @@ -140,6 +140,9 @@ class EPG(): if entry.is_file(): if entry.name[0] != '_' and entry.name.endswith(".py"): new_epgtype_list.append(str(entry.name[:-3])) + elif entry.is_dir(): + if entry.name[0] != '_': + new_epgtype_list.append(str(entry.name)) for method in new_epgtype_list: self.fhdhr.logger.info("Found %s EPG method." % method) self.epg_handling[method] = eval("self.alternative_epg.%s.%sEPG(self.fhdhr, self.channels)" % (method, method))