From 929160b1e7888ea56cfb9fe445b5bebcd7901547 Mon Sep 17 00:00:00 2001 From: jbleyel Date: Sat, 9 Dec 2023 14:03:21 +0100 Subject: [PATCH 1/3] [Softcam] * add setting to hide server name and ip Note! All converter needs also a change to support this new setting. --- data/setup.xml | 1 + lib/python/Components/UsageConfig.py | 1 + lib/python/Screens/OScamInfo.py | 6 +++++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/data/setup.xml b/data/setup.xml index 5b409647a46..2d4f6960320 100644 --- a/data/setup.xml +++ b/data/setup.xml @@ -742,6 +742,7 @@ config.misc.softcams config.softcam.showInExtensions + config.softcam.hideServerName diff --git a/lib/python/Components/UsageConfig.py b/lib/python/Components/UsageConfig.py index b33f00abc4b..f73919b4c7c 100755 --- a/lib/python/Components/UsageConfig.py +++ b/lib/python/Components/UsageConfig.py @@ -1884,6 +1884,7 @@ def autolanguagesub(configElement): config.softcam = ConfigSubsection() config.softcam.showInExtensions = ConfigYesNo(default=False) + config.softcam.hideServerName = ConfigYesNo(default=False) config.oscaminfo = ConfigSubsection() config.oscaminfo.userdatafromconf = ConfigYesNo(default=True) diff --git a/lib/python/Screens/OScamInfo.py b/lib/python/Screens/OScamInfo.py index 6d0710fb312..995b43364e8 100644 --- a/lib/python/Screens/OScamInfo.py +++ b/lib/python/Screens/OScamInfo.py @@ -250,6 +250,9 @@ def readXML(self, typ): port = cl.find("connection").attrib["port"] connstatus = cl.find("connection").text if name != "" and name != "anonymous" and proto != "": + if config.softcam.hideServerName.value: + srvname_short = "XXX" + name = "XXX" try: tmp[cl.attrib["type"]].append((name, proto, "%s:%s" % (caid, srvid), srvname_short, ecmtime, ip, connstatus)) except KeyError: @@ -366,7 +369,8 @@ def getECMInfo(self, ecminfo): elif "reader" in i: result.append((_("Reader"), i.split(":")[1].strip())) elif "from" in i: - result.append((_("Address"), i.split(":")[1].strip())) + server = "" if config.softcam.hideServerName.value else i.split(":")[1].strip() + result.append((_("Address"), server)) elif "protocol" in i: result.append((_("Protocol"), i.split(":")[1].strip())) elif "hops" in i: From e4cbc5d4129f0530feaf28f1e2d2dec916d14f40 Mon Sep 17 00:00:00 2001 From: jbleyel Date: Sat, 9 Dec 2023 16:26:46 +0100 Subject: [PATCH 2/3] [Converter/VtiInfo] * hide servername from ecm.info [Tools/GetEcmInfo] * hide servername from ecm.info --- lib/python/Components/Converter/VtiInfo.py | 2 ++ lib/python/Tools/GetEcmInfo.py | 3 +++ 2 files changed, 5 insertions(+) diff --git a/lib/python/Components/Converter/VtiInfo.py b/lib/python/Components/Converter/VtiInfo.py index ddf11bed414..05e4e3d0009 100644 --- a/lib/python/Components/Converter/VtiInfo.py +++ b/lib/python/Components/Converter/VtiInfo.py @@ -143,6 +143,8 @@ def ecmfile(self): if y != -1: info['caid'] = line[x + 5:y] + if info and info.get("from") and config.softcam.hideServerName.value: + info["from"] = "XXX" return info def tempfile(self): diff --git a/lib/python/Tools/GetEcmInfo.py b/lib/python/Tools/GetEcmInfo.py index 69d2f8de19f..e139d43f161 100644 --- a/lib/python/Tools/GetEcmInfo.py +++ b/lib/python/Tools/GetEcmInfo.py @@ -1,5 +1,6 @@ from os import stat from time import time +from Components.config import config ECM_INFO = "/tmp/ecm.info" EMPTY_ECM_INFO = "", "0", "0", "0" @@ -58,6 +59,8 @@ def pollEcmData(self): d = line.split(":", 1) if len(d) > 1: info[d[0].strip()] = d[1].strip() + if info and info.get("from") and config.softcam.hideServerName.value: + info["from"] = "XXX" data = self.getText() return True else: From 606b731ecfb2caf7c9a67d4671102e65ed9e5eb7 Mon Sep 17 00:00:00 2001 From: jbleyel Date: Mon, 25 Dec 2023 10:38:49 +0100 Subject: [PATCH 3/3] * use different character for hide * revert OscamInfo because this will be refactored --- lib/python/Components/Converter/VtiInfo.py | 2 +- lib/python/Screens/OScamInfo.py | 6 +----- lib/python/Tools/GetEcmInfo.py | 2 +- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/python/Components/Converter/VtiInfo.py b/lib/python/Components/Converter/VtiInfo.py index 05e4e3d0009..192df9c3983 100644 --- a/lib/python/Components/Converter/VtiInfo.py +++ b/lib/python/Components/Converter/VtiInfo.py @@ -144,7 +144,7 @@ def ecmfile(self): info['caid'] = line[x + 5:y] if info and info.get("from") and config.softcam.hideServerName.value: - info["from"] = "XXX" + info["from"] = "\u2022" return info def tempfile(self): diff --git a/lib/python/Screens/OScamInfo.py b/lib/python/Screens/OScamInfo.py index 995b43364e8..6d0710fb312 100644 --- a/lib/python/Screens/OScamInfo.py +++ b/lib/python/Screens/OScamInfo.py @@ -250,9 +250,6 @@ def readXML(self, typ): port = cl.find("connection").attrib["port"] connstatus = cl.find("connection").text if name != "" and name != "anonymous" and proto != "": - if config.softcam.hideServerName.value: - srvname_short = "XXX" - name = "XXX" try: tmp[cl.attrib["type"]].append((name, proto, "%s:%s" % (caid, srvid), srvname_short, ecmtime, ip, connstatus)) except KeyError: @@ -369,8 +366,7 @@ def getECMInfo(self, ecminfo): elif "reader" in i: result.append((_("Reader"), i.split(":")[1].strip())) elif "from" in i: - server = "" if config.softcam.hideServerName.value else i.split(":")[1].strip() - result.append((_("Address"), server)) + result.append((_("Address"), i.split(":")[1].strip())) elif "protocol" in i: result.append((_("Protocol"), i.split(":")[1].strip())) elif "hops" in i: diff --git a/lib/python/Tools/GetEcmInfo.py b/lib/python/Tools/GetEcmInfo.py index e139d43f161..b0522e414bc 100644 --- a/lib/python/Tools/GetEcmInfo.py +++ b/lib/python/Tools/GetEcmInfo.py @@ -60,7 +60,7 @@ def pollEcmData(self): if len(d) > 1: info[d[0].strip()] = d[1].strip() if info and info.get("from") and config.softcam.hideServerName.value: - info["from"] = "XXX" + info["from"] = "\u2022" data = self.getText() return True else: