test
This commit is contained in:
parent
8450c78d8f
commit
f64c33e891
@ -42,25 +42,6 @@ class OriginServiceWrapper():
|
|||||||
def update_epg(self, channels):
|
def update_epg(self, channels):
|
||||||
return self.epg.update_epg(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):
|
def __getattr__(self, name):
|
||||||
''' will only get called for undefined attributes '''
|
''' will only get called for undefined attributes '''
|
||||||
if hasattr(self.fhdhr, name):
|
if hasattr(self.fhdhr, name):
|
||||||
|
|||||||
@ -30,3 +30,5 @@ class fHDHR_API():
|
|||||||
self.debug = Debug_JSON(fhdhr)
|
self.debug = Debug_JSON(fhdhr)
|
||||||
|
|
||||||
self.images = Images(fhdhr)
|
self.images = Images(fhdhr)
|
||||||
|
|
||||||
|
self.origin_api = self.fhdhr.originwrapper.origin.Origin_API(fhdhr)
|
||||||
|
|||||||
16
origin/origin_api.py
Normal file
16
origin/origin_api.py
Normal file
@ -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"
|
||||||
@ -19,6 +19,9 @@ class Origin_HTML():
|
|||||||
|
|
||||||
def get(self, *args):
|
def get(self, *args):
|
||||||
|
|
||||||
origin_status_dict = self.fhdhr.originwrapper.originservice.get_status_dict()
|
if self.fhdhr.originwrapper.setup_success:
|
||||||
|
origin_status_dict = {"Setup": "Success"}
|
||||||
origin_status_dict["Total Channels"] = len(self.fhdhr.device.channels.list)
|
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)
|
return render_template_string(self.template.getvalue(), request=request, fhdhr=self.fhdhr, origin_status_dict=origin_status_dict, list=list)
|
||||||
|
|||||||
@ -25,9 +25,3 @@ class OriginService():
|
|||||||
self.filter_dict[filter].extend(filterconf)
|
self.filter_dict[filter].extend(filterconf)
|
||||||
else:
|
else:
|
||||||
self.fhdhr.logger.info("Found No Enabled %s Filters" % (filter))
|
self.fhdhr.logger.info("Found No Enabled %s Filters" % (filter))
|
||||||
|
|
||||||
def get_status_dict(self):
|
|
||||||
ret_status_dict = {
|
|
||||||
"Login": "Success",
|
|
||||||
}
|
|
||||||
return ret_status_dict
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user