From 47d2dd1ab9f5f447a1f3e567be533c4c1df01f78 Mon Sep 17 00:00:00 2001 From: deathbybandaid Date: Fri, 27 Nov 2020 17:18:47 -0500 Subject: [PATCH] test --- data/internal_config/serviceconf.json | 5 +++++ fHDHR/device/channels/__init__.py | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/data/internal_config/serviceconf.json b/data/internal_config/serviceconf.json index 70c887a..20528e1 100644 --- a/data/internal_config/serviceconf.json +++ b/data/internal_config/serviceconf.json @@ -32,6 +32,11 @@ "config_file": true, "config_web": true }, + "chanscan_on_start":{ + "value": false, + "config_file": true, + "config_web": true + }, "stream_type":{ "value": "direct", "config_file": true, diff --git a/fHDHR/device/channels/__init__.py b/fHDHR/device/channels/__init__.py index 7abc1c7..c0ed0b2 100644 --- a/fHDHR/device/channels/__init__.py +++ b/fHDHR/device/channels/__init__.py @@ -1,4 +1,5 @@ import datetime +import time from fHDHR.tools import hours_between_datetime @@ -19,7 +20,9 @@ class Channels(): self.list_update_time = None self.get_db_channels() - self.get_channels() + neverscanned = self.fhdhr.db.get_fhdhr_value("channels", "scanned_time") + if (self.fhdhr.config.dict["fhdhr"]["chanscan_on_start"] or neverscanned): + self.get_channels() def get_channel_obj(self, keyfind, valfind): return next(self.list[fhdhr_id] for fhdhr_id in list(self.list.keys()) if self.list[fhdhr_id].dict[keyfind] == valfind) @@ -68,6 +71,7 @@ class Channels(): if not self.list_update_time: self.fhdhr.logger.info("Found " + str(len(self.list)) + " channels for " + str(self.fhdhr.config.dict["main"]["servicename"])) self.list_update_time = datetime.datetime.now() + self.fhdhr.db.set_fhdhr_value("channels", "scanned_time", time.time()) channel_list = [] for chan_obj in list(self.list.keys()):