diff --git a/app/eparser/ecommons.py b/app/eparser/ecommons.py
index 30118cab..9b3fa889 100644
--- a/app/eparser/ecommons.py
+++ b/app/eparser/ecommons.py
@@ -2,7 +2,7 @@
#
# The MIT License (MIT)
#
-# Copyright (c) 2018-2021 Dmitriy Yefremov
+# Copyright (c) 2018-2022 Dmitriy Yefremov
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
@@ -61,8 +61,8 @@ BouquetService = namedtuple("BouquetService", ["name", "type", "data", "num"])
Satellite = namedtuple("Satellite", ["name", "flags", "position", "transponders"])
-Transponder = namedtuple("Transponder", ["frequency", "symbol_rate", "polarization", "fec_inner",
- "system", "modulation", "pls_mode", "pls_code", "is_id"])
+Transponder = namedtuple("Transponder", ["frequency", "symbol_rate", "polarization", "fec_inner", "system",
+ "modulation", "pls_mode", "pls_code", "is_id", "t2mi_plp_id"])
class TrType(Enum):
@@ -247,6 +247,7 @@ def is_transponder_valid(tr: Transponder):
tr.pls_mode is None or int(tr.pls_mode)
tr.pls_code is None or int(tr.pls_code)
tr.is_id is None or int(tr.is_id)
+ tr.t2mi_plp_id is None or int(tr.t2mi_plp_id)
except (TypeError, ValueError) as e:
log(f"Transponder validation error: {e}\n{tr}")
return False
diff --git a/app/eparser/satxml.py b/app/eparser/satxml.py
index e4c78384..46f2d9c2 100644
--- a/app/eparser/satxml.py
+++ b/app/eparser/satxml.py
@@ -1,4 +1,32 @@
-""" Module foe parsing Satellites.xml
+# -*- coding: utf-8 -*-
+#
+# The MIT License (MIT)
+#
+# Copyright (c) 2018-2022 Dmitriy Yefremov
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+#
+# Author: Dmitriy Yefremov
+#
+
+
+""" Module for parsing satellites.xml file.
For more info see __COMMENT
"""
@@ -62,6 +90,8 @@ def write_satellites(satellites, data_path):
transponder_child.setAttribute("pls_code", tr.pls_code)
if tr.is_id:
transponder_child.setAttribute("is_id", tr.is_id)
+ if tr.t2mi_plp_id:
+ transponder_child.setAttribute("t2mi_plp_id", tr.t2mi_plp_id)
sat_child.appendChild(transponder_child)
root.appendChild(sat_child)
doc.writexml(open(data_path, "w"),
@@ -87,9 +117,10 @@ def parse_transponders(elem, sat_name):
MODULATION[atr["modulation"].value],
atr["pls_mode"].value if "pls_mode" in atr else None,
atr["pls_code"].value if "pls_code" in atr else None,
- atr["is_id"].value if "is_id" in atr else None)
+ atr["is_id"].value if "is_id" in atr else None,
+ atr["t2mi_plp_id"].value if "t2mi_plp_id" in atr else None)
except Exception as e:
- message = "Error: can't parse transponder for '{}' satellite! {}".format(sat_name, repr(e))
+ message = f"Error: can't parse transponder for '{sat_name}' satellite! {repr(e)}"
log(message)
else:
transponders.append(tr)
@@ -97,7 +128,7 @@ def parse_transponders(elem, sat_name):
def parse_sat(elem):
- """ Parsing satellite """
+ """ Parsing satellite. """
sat_name = elem.attributes["name"].value
return Satellite(sat_name,
elem.attributes["flags"].value,
@@ -106,7 +137,7 @@ def parse_sat(elem):
def parse_satellites(path):
- """ Parsing satellites from xml"""
+ """ Parsing satellites from xml. """
dom = parse(path)
satellites = []
diff --git a/app/tools/satellites.py b/app/tools/satellites.py
index e4d1795c..e544c460 100644
--- a/app/tools/satellites.py
+++ b/app/tools/satellites.py
@@ -327,7 +327,7 @@ class SatellitesParser(HTMLParser):
if is_transponder_valid(tr):
n_trs.append(tr)
- tr = Transponder(f"{freq}000", f"{sr}000", pol, fec, sys, mod, pls_mode, pls_code, None)
+ tr = Transponder(f"{freq}000", f"{sr}000", pol, fec, sys, mod, pls_mode, pls_code, None, None)
if is_transponder_valid(tr):
trs.append(tr)
@@ -363,7 +363,7 @@ class SatellitesParser(HTMLParser):
if plp is not None:
log(f"Detected T2-MI transponder! [{freq} {sr} {pol}] ")
- tr = Transponder(f"{freq}000", f"{sr}000", pol, fec, sys, mod, pls_mode, pls_code, is_id)
+ tr = Transponder(f"{freq}000", f"{sr}000", pol, fec, sys, mod, pls_mode, pls_code, is_id, None)
if is_transponder_valid(tr):
trs.append(tr)
@@ -400,7 +400,7 @@ class SatellitesParser(HTMLParser):
if t2_mi:
log(f"Detected T2-MI transponder! [{freq} {sr} {pol}] ")
- tr = Transponder(freq, f"{sr}000", pol, fec, sys, mod, pls_id, pls_code, is_id)
+ tr = Transponder(freq, f"{sr}000", pol, fec, sys, mod, pls_id, pls_code, is_id, None)
if is_transponder_valid(tr):
trs.append(tr)
diff --git a/app/ui/satellites.glade b/app/ui/satellites.glade
index b4bb80ce..0b22a38f 100644
--- a/app/ui/satellites.glade
+++ b/app/ui/satellites.glade
@@ -3,7 +3,7 @@
The MIT License (MIT)
-Copyright (c) 2018-2021 Dmitriy Yefremov
+Copyright (c) 2018-2022 Dmitriy Yefremov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -399,7 +399,7 @@ Author: Dmitriy Yefremov
555
- 2
+ 5
diff --git a/app/ui/satellites.py b/app/ui/satellites.py
index 69541d51..dc97244f 100644
--- a/app/ui/satellites.py
+++ b/app/ui/satellites.py
@@ -304,6 +304,7 @@ class TransponderDialog:
self._pls_mode_box = builder.get_object("pls_mode_box")
self._pls_code_entry = builder.get_object("pls_code_entry")
self._is_id_entry = builder.get_object("is_id_entry")
+ self._t2mi_plp_id_entry = builder.get_object("t2mi_plp_id_entry")
# pattern for frequency and rate entries (only digits)
self._pattern = re.compile(r"\D")
# style
@@ -336,6 +337,7 @@ class TransponderDialog:
self._pls_mode_box.set_active_id(PLS_MODE.get(transponder.pls_mode, None))
self._is_id_entry.set_text(transponder.is_id if transponder.is_id else "")
self._pls_code_entry.set_text(transponder.pls_code if transponder.pls_code else "")
+ self._t2mi_plp_id_entry.set_text(transponder.t2mi_plp_id if transponder.t2mi_plp_id else "")
def to_transponder(self):
return Transponder(frequency=self._freq_entry.get_text(),
@@ -346,7 +348,8 @@ class TransponderDialog:
modulation=self._mod_box.get_active_id(),
pls_mode=get_key_by_value(PLS_MODE, self._pls_mode_box.get_active_id()),
pls_code=self._pls_code_entry.get_text(),
- is_id=self._is_id_entry.get_text())
+ is_id=self._is_id_entry.get_text(),
+ t2mi_plp_id=self._t2mi_plp_id_entry.get_text())
def on_entry_changed(self, entry):
entry.set_name("digit-entry" if self._pattern.search(entry.get_text()) else "GtkEntry")
@@ -360,6 +363,8 @@ class TransponderDialog:
return False
elif self._pattern.search(tr.pls_code) or self._pattern.search(tr.is_id):
return False
+ elif self._pattern.search(tr.t2mi_plp_id):
+ return False
return True