diff --git a/fHDHR/device/channels/__init__.py b/fHDHR/device/channels/__init__.py index 2767273..7abc1c7 100644 --- a/fHDHR/device/channels/__init__.py +++ b/fHDHR/device/channels/__init__.py @@ -17,6 +17,7 @@ class Channels(): self.list = {} self.list_update_time = None + self.get_db_channels() self.get_channels() @@ -30,7 +31,10 @@ class Channels(): self.get_channel_obj(keyfind, valfind).set_status(updatedict) def get_db_channels(self): + self.fhdhr.logger.info("Checking for Channel information stored in the database.") channel_ids = self.fhdhr.db.get_fhdhr_value("channels", "list") or [] + if len(channel_ids): + self.fhdhr.logger.info("Found %s existing channels in the database." % str(len(channel_ids))) for channel_id in channel_ids: channel_obj = Channel(self.fhdhr, self.id_system, channel_id=channel_id) channel_id = channel_obj.dict["id"] @@ -53,6 +57,7 @@ class Channels(): updatelist = True if updatelist: + self.fhdhr.logger.info("Performing Channel Scan.") channel_dict_list = self.origin.get_channels() for channel_info in channel_dict_list: channel_obj = Channel(self.fhdhr, self.id_system, origin_id=channel_info["id"]) diff --git a/fHDHR/device/cluster.py b/fHDHR/device/cluster.py index 4c1b824..1bf15a5 100644 --- a/fHDHR/device/cluster.py +++ b/fHDHR/device/cluster.py @@ -12,6 +12,7 @@ class fHDHR_Cluster(): self.friendlyname = self.fhdhr.config.dict["fhdhr"]["friendlyname"] self.location = None self.location_url = None + if fhdhr.config.dict["fhdhr"]["discovery_address"]: self.location = ('http://' + fhdhr.config.dict["fhdhr"]["discovery_address"] + ':' + str(fhdhr.config.dict["fhdhr"]["port"])) @@ -65,9 +66,15 @@ class fHDHR_Cluster(): return defdict def startup_sync(self): + self.fhdhr.logger.info("Syncronizing with Cluster.") cluster = self.fhdhr.db.get_fhdhr_value("cluster", "dict") or self.default_cluster() + if not len(list(cluster.keys())): + self.fhdhr.logger.info("No Cluster Found.") + else: + self.fhdhr.logger.info("Found %s clustered services." % str(len(list(cluster.keys())))) for location in list(cluster.keys()): if location != self.location: + self.fhdhr.logger.info("Checking Cluster Syncronization information from %s." % location) sync_url = location + "/api/cluster?method=get" try: sync_open = self.fhdhr.web.session.get(sync_url) @@ -78,12 +85,14 @@ class fHDHR_Cluster(): self.fhdhr.logger.error("Unreachable: " + location) def leave(self): + self.fhdhr.logger.info("Leaving cluster.") self.fhdhr.db.set_fhdhr_value("cluster", "dict", self.default_cluster()) def disconnect(self): cluster = self.fhdhr.db.get_fhdhr_value("cluster", "dict") or self.default_cluster() for location in list(cluster.keys()): if location != self.location: + self.fhdhr.logger.info("Informing %s that I am departing the Cluster." % location) sync_url = location + "/api/cluster?method=del&location=" + self.location try: self.fhdhr.web.session.get(sync_url) @@ -112,6 +121,7 @@ class fHDHR_Cluster(): def add(self, location): cluster = self.fhdhr.db.get_fhdhr_value("cluster", "dict") or self.default_cluster() if location not in list(cluster.keys()): + self.fhdhr.logger.info("Adding %s to cluster." % location) cluster[location] = {"base_url": location} location_info_url = location + "/discover.json" @@ -144,6 +154,7 @@ class fHDHR_Cluster(): def remove(self, location): cluster = self.fhdhr.db.get_fhdhr_value("cluster", "dict") or self.default_cluster() if location in list(cluster.keys()): + self.fhdhr.logger.info("Removing %s from cluster." % location) del cluster[location] sync_url = location + "/api/cluster?method=leave" try: diff --git a/fHDHR/device/epg.py b/fHDHR/device/epg.py index d5e89e5..788c177 100644 --- a/fHDHR/device/epg.py +++ b/fHDHR/device/epg.py @@ -134,7 +134,9 @@ class EPG(): return next(item for item in event_list if item["id"] == event_id) def epg_method_selfadd(self): + self.fhdhr.logger.info("Checking for Optional EPG methods.") for method in epgtype_list: + self.fhdhr.logger.info("Found %s EPG method." % method) exec("%s = %s" % ("self." + str(method), str(method) + "." + str(method) + "EPG(self.fhdhr, self.channels)")) def update(self, method=None): diff --git a/fHDHR/device/tuners/__init__.py b/fHDHR/device/tuners/__init__.py index d42903b..b8c4d03 100644 --- a/fHDHR/device/tuners/__init__.py +++ b/fHDHR/device/tuners/__init__.py @@ -15,6 +15,8 @@ class Tuners(): self.tuners = {} + self.fhdhr.logger.info("Creating %s tuners." % str(self.max_tuners)) + for i in range(1, self.max_tuners + 1): self.tuners[i] = Tuner(fhdhr, i, epg) diff --git a/fHDHR/http/__init__.py b/fHDHR/http/__init__.py index 30e755e..bcf167e 100644 --- a/fHDHR/http/__init__.py +++ b/fHDHR/http/__init__.py @@ -15,17 +15,23 @@ class fHDHR_HTTP_Server(): self.template_folder = fhdhr.config.internal["paths"]["www_templates_dir"] + self.fhdhr.logger.info("Loading Flask.") + self.app = Flask("fHDHR", template_folder=self.template_folder) + self.fhdhr.logger.info("Loading HTTP Pages Endpoints.") self.pages = fHDHR_Pages(fhdhr) self.add_endpoints(self.pages, "pages") + self.fhdhr.logger.info("Loading HTTP Files Endpoints.") self.files = fHDHR_Files(fhdhr) self.add_endpoints(self.files, "files") + self.fhdhr.logger.info("Loading HTTP API Endpoints.") self.api = fHDHR_API(fhdhr) self.add_endpoints(self.api, "api") + self.fhdhr.logger.info("Loading HTTP Stream Endpoints.") self.watch = fHDHR_WATCH(fhdhr) self.add_endpoints(self.watch, "watch") @@ -41,6 +47,7 @@ class fHDHR_HTTP_Server(): endpoint_methods = eval("self." + str(index_name) + "." + str(item) + ".endpoint_methods") except AttributeError: endpoint_methods = ['GET'] + self.fhdhr.logger.info("Adding endpoint %s available at %s with %s methods." % (endpoint_name, ",".join(endpoints), ",".join(endpoint_methods))) for endpoint in endpoints: self.add_endpoint(endpoint=endpoint, endpoint_name=endpoint_name, diff --git a/fHDHR/http/api/lineup_post.py b/fHDHR/http/api/lineup_post.py index 92403f9..a9cc62c 100644 --- a/fHDHR/http/api/lineup_post.py +++ b/fHDHR/http/api/lineup_post.py @@ -3,7 +3,7 @@ from flask import request, abort, Response class Lineup_Post(): endpoints = ["/lineup.post"] - endpoint_name = "lineup_post" + endpoint_name = "api_lineup_post" endpoint_methods = ["POST"] def __init__(self, fhdhr): diff --git a/fHDHR/http/files/device_xml.py b/fHDHR/http/files/device_xml.py index 208346b..b1e590c 100644 --- a/fHDHR/http/files/device_xml.py +++ b/fHDHR/http/files/device_xml.py @@ -7,7 +7,7 @@ from fHDHR.tools import sub_el class Device_XML(): endpoints = ["/device.xml"] - endpoint_name = "device_xml" + endpoint_name = "file_device_xml" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/files/discover_json.py b/fHDHR/http/files/discover_json.py index 4df11fb..79d57ca 100644 --- a/fHDHR/http/files/discover_json.py +++ b/fHDHR/http/files/discover_json.py @@ -4,7 +4,7 @@ import json class Discover_JSON(): endpoints = ["/discover.json"] - endpoint_name = "discover_json" + endpoint_name = "file_discover_json" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/files/favicon_ico.py b/fHDHR/http/files/favicon_ico.py index 890a0c5..dabc50a 100644 --- a/fHDHR/http/files/favicon_ico.py +++ b/fHDHR/http/files/favicon_ico.py @@ -3,7 +3,7 @@ from flask import send_from_directory class Favicon_ICO(): endpoints = ["/favicon.ico"] - endpoint_name = "favicon" + endpoint_name = "file_favicon_ico" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/files/lineup_json.py b/fHDHR/http/files/lineup_json.py index 463f737..7a4e3c4 100644 --- a/fHDHR/http/files/lineup_json.py +++ b/fHDHR/http/files/lineup_json.py @@ -4,7 +4,7 @@ import json class Lineup_JSON(): endpoints = ["/lineup.json"] - endpoint_name = "lineup_json" + endpoint_name = "file_lineup_json" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/files/lineup_status_json.py b/fHDHR/http/files/lineup_status_json.py index f50b3c0..e5273f1 100644 --- a/fHDHR/http/files/lineup_status_json.py +++ b/fHDHR/http/files/lineup_status_json.py @@ -4,7 +4,7 @@ import json class Lineup_Status_JSON(): endpoints = ["/lineup_status.json"] - endpoint_name = "lineup_status_json" + endpoint_name = "file_lineup_status_json" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/files/lineup_xml.py b/fHDHR/http/files/lineup_xml.py index 3f787c1..8a8a687 100644 --- a/fHDHR/http/files/lineup_xml.py +++ b/fHDHR/http/files/lineup_xml.py @@ -7,7 +7,7 @@ from fHDHR.tools import sub_el class Lineup_XML(): endpoints = ["/lineup.xml"] - endpoint_name = "lineup_xml" + endpoint_name = "file_lineup_xml" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/files/style_css.py b/fHDHR/http/files/style_css.py index e6e3134..b5a1598 100644 --- a/fHDHR/http/files/style_css.py +++ b/fHDHR/http/files/style_css.py @@ -3,7 +3,7 @@ from flask import send_from_directory class Style_CSS(): endpoints = ["/style.css"] - endpoint_name = "style" + endpoint_name = "file_style_css" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/channels_html.py b/fHDHR/http/pages/channels_html.py index fe90fb3..193b214 100644 --- a/fHDHR/http/pages/channels_html.py +++ b/fHDHR/http/pages/channels_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class Channels_HTML(): endpoints = ["/channels", "/channels.html"] - endpoint_name = "channels_html" + endpoint_name = "page_channels_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/cluster_html.py b/fHDHR/http/pages/cluster_html.py index d88d1c6..95fdb21 100644 --- a/fHDHR/http/pages/cluster_html.py +++ b/fHDHR/http/pages/cluster_html.py @@ -4,7 +4,7 @@ import urllib.parse class Cluster_HTML(): endpoints = ["/cluster", "/cluster.html"] - endpoint_name = "cluster_html" + endpoint_name = "page_cluster_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/diagnostics_html.py b/fHDHR/http/pages/diagnostics_html.py index 8f0ec79..456f799 100644 --- a/fHDHR/http/pages/diagnostics_html.py +++ b/fHDHR/http/pages/diagnostics_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class Diagnostics_HTML(): endpoints = ["/diagnostics", "/diagnostics.html"] - endpoint_name = "diagnostics_html" + endpoint_name = "page_diagnostics_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/guide_html.py b/fHDHR/http/pages/guide_html.py index a8dd779..626eca7 100644 --- a/fHDHR/http/pages/guide_html.py +++ b/fHDHR/http/pages/guide_html.py @@ -6,7 +6,7 @@ from fHDHR.tools import humanized_time class Guide_HTML(): endpoints = ["/guide", "/guide.html"] - endpoint_name = "guide_html" + endpoint_name = "page_guide_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/index_html.py b/fHDHR/http/pages/index_html.py index 673b1ea..4392472 100644 --- a/fHDHR/http/pages/index_html.py +++ b/fHDHR/http/pages/index_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class Index_HTML(): endpoints = ["/", "/index", "/index.html"] - endpoint_name = "root_html" + endpoint_name = "page_root_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/origin_html.py b/fHDHR/http/pages/origin_html.py index 2de0b05..82ca881 100644 --- a/fHDHR/http/pages/origin_html.py +++ b/fHDHR/http/pages/origin_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class Origin_HTML(): endpoints = ["/origin", "/origin.html"] - endpoint_name = "origin_html" + endpoint_name = "page_origin_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/settings_html.py b/fHDHR/http/pages/settings_html.py index aff7ee9..de7d615 100644 --- a/fHDHR/http/pages/settings_html.py +++ b/fHDHR/http/pages/settings_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class Settings_HTML(): endpoints = ["/settings", "/settings.html"] - endpoint_name = "settings_html" + endpoint_name = "page_settings_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/streams_html.py b/fHDHR/http/pages/streams_html.py index 97b0d10..292ba74 100644 --- a/fHDHR/http/pages/streams_html.py +++ b/fHDHR/http/pages/streams_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class Streams_HTML(): endpoints = ["/streams", "/streams.html"] - endpoint_name = "streams_html" + endpoint_name = "page_streams_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/version_html.py b/fHDHR/http/pages/version_html.py index 7c0c72a..24eca65 100644 --- a/fHDHR/http/pages/version_html.py +++ b/fHDHR/http/pages/version_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class Version_HTML(): endpoints = ["/version", "/version.html"] - endpoint_name = "version_html" + endpoint_name = "page_version_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/pages/xmltv_html.py b/fHDHR/http/pages/xmltv_html.py index 33cfafe..869f0b7 100644 --- a/fHDHR/http/pages/xmltv_html.py +++ b/fHDHR/http/pages/xmltv_html.py @@ -3,7 +3,7 @@ from flask import request, render_template class xmlTV_HTML(): endpoints = ["/xmltv", "/xmltv.html"] - endpoint_name = "xmltv_html" + endpoint_name = "page_xmltv_html" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/watch/auto.py b/fHDHR/http/watch/auto.py index d2df5f5..789cd5b 100644 --- a/fHDHR/http/watch/auto.py +++ b/fHDHR/http/watch/auto.py @@ -4,7 +4,7 @@ import urllib.parse class Auto(): endpoints = ['/auto/'] - endpoint_name = "auto" + endpoint_name = "watch_auto" def __init__(self, fhdhr): self.fhdhr = fhdhr diff --git a/fHDHR/http/watch/tuner.py b/fHDHR/http/watch/tuner.py index e555ea1..418207f 100644 --- a/fHDHR/http/watch/tuner.py +++ b/fHDHR/http/watch/tuner.py @@ -4,7 +4,7 @@ import urllib.parse class Tuner(): endpoints = ['/tuner/'] - endpoint_name = "tuner" + endpoint_name = "watch_tuner" def __init__(self, fhdhr): self.fhdhr = fhdhr