From f64c33e89173de0e6eddf6785a9becac4013b0ce Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Thu, 10 Dec 2020 00:24:45 -0500 Subject: [PATCH] test --- fHDHR/originwrapper/__init__.py | 19 ------------------- fHDHR_web/api/__init__.py | 2 ++ origin/origin_api.py | 16 ++++++++++++++++ origin/origin_html.py | 7 +++++-- origin/origin_service.py | 6 ------ 5 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 origin/origin_api.py diff --git a/fHDHR/originwrapper/__init__.py b/fHDHR/originwrapper/__init__.py index 87bc24b..2e59e70 100644 --- a/fHDHR/originwrapper/__init__.py +++ b/fHDHR/originwrapper/__init__.py @@ -42,25 +42,6 @@ class OriginServiceWrapper(): def update_epg(self, channels): return self.epg.update_epg(channels) - def get_status_dict(self): - - if self.setup_success: - status_dict = { - "Setup": "Success", - } - - try: - full_status_dict = self.origin.get_status_dict() - for status_key in list(full_status_dict.keys()): - status_dict[status_key] = full_status_dict[status_key] - return status_dict - except AttributeError: - return status_dict - else: - return { - "Setup": "Failed", - } - def __getattr__(self, name): ''' will only get called for undefined attributes ''' if hasattr(self.fhdhr, name): diff --git a/fHDHR_web/api/__init__.py b/fHDHR_web/api/__init__.py index 359f9a6..1fc4ff0 100644 --- a/fHDHR_web/api/__init__.py +++ b/fHDHR_web/api/__init__.py @@ -30,3 +30,5 @@ class fHDHR_API(): self.debug = Debug_JSON(fhdhr) self.images = Images(fhdhr) + + self.origin_api = self.fhdhr.originwrapper.origin.Origin_API(fhdhr) diff --git a/origin/origin_api.py b/origin/origin_api.py new file mode 100644 index 0000000..a23494e --- /dev/null +++ b/origin/origin_api.py @@ -0,0 +1,16 @@ + + +class Origin_API(): + endpoints = ["/api/origin"] + endpoint_name = "api_origin" + endpoint_methods = ["GET", "POST"] + + def __init__(self, fhdhr): + self.fhdhr = fhdhr + + def __call__(self, *args): + return self.get(*args) + + def get(self, *args): + + return "Success" diff --git a/origin/origin_html.py b/origin/origin_html.py index 765512b..dacb369 100644 --- a/origin/origin_html.py +++ b/origin/origin_html.py @@ -19,6 +19,9 @@ class Origin_HTML(): def get(self, *args): - origin_status_dict = self.fhdhr.originwrapper.originservice.get_status_dict() - origin_status_dict["Total Channels"] = len(self.fhdhr.device.channels.list) + if self.fhdhr.originwrapper.setup_success: + origin_status_dict = {"Setup": "Success"} + origin_status_dict["Total Channels"] = len(self.fhdhr.device.channels.list) + else: + origin_status_dict = {"Setup": "Failed"} return render_template_string(self.template.getvalue(), request=request, fhdhr=self.fhdhr, origin_status_dict=origin_status_dict, list=list) diff --git a/origin/origin_service.py b/origin/origin_service.py index a51f51e..3118d59 100644 --- a/origin/origin_service.py +++ b/origin/origin_service.py @@ -25,9 +25,3 @@ class OriginService(): self.filter_dict[filter].extend(filterconf) else: self.fhdhr.logger.info("Found No Enabled %s Filters" % (filter)) - - def get_status_dict(self): - ret_status_dict = { - "Login": "Success", - } - return ret_status_dict