From 16f8df023894ca368ed5d830cfa031fcd8183421 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Fri, 18 Jan 2019 18:26:48 +0300 Subject: [PATCH] added elems for cable and terrestrial services --- app/eparser/ecommons.py | 27 +++++++++++++++++++++++++-- app/eparser/enigma/lamedb.py | 30 +++++++++++++++++++----------- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/app/eparser/ecommons.py b/app/eparser/ecommons.py index 87232136..3c7b5478 100644 --- a/app/eparser/ecommons.py +++ b/app/eparser/ecommons.py @@ -30,7 +30,7 @@ Transponder = namedtuple("Transponder", ["frequency", "symbol_rate", "polarizati class TrType(Enum): """ Transponders type """ Satellite = "s" - Terestrial = "t" + Terrestrial = "t" Cable = "c" @@ -98,6 +98,12 @@ class Pilot(Enum): Auto = "2" +class SystemCable(Enum): + """ System of cable service """ + ANNEX_A = 0 + ANNEX_C = 1 + + ROLL_OFF = {"0": "35%", "1": "25%", "2": "20%", "3": "Auto"} POLARIZATION = {"0": "H", "1": "V", "2": "L", "3": "R"} @@ -110,7 +116,7 @@ FEC = {"0": "Auto", "1": "1/2", "2": "2/3", "3": "3/4", "4": "5/6", "5": "7/8", "25": "3/5", "26": "4/5", "27": "9/10", "28": "Auto"} FEC_DEFAULT = {"0": "Auto", "1": "1/2", "2": "2/3", "3": "3/4", "4": "5/6", "5": "7/8", "6": "8/9", "7": "3/5", - "8": "4/5", "9": "9/10"} + "8": "4/5", "9": "9/10", "10": "6/7", "15": "None"} SYSTEM = {"0": "DVB-S", "1": "DVB-S2"} @@ -119,6 +125,23 @@ MODULATION = {"0": "Auto", "1": "QPSK", "2": "8PSK", "4": "16APSK", "5": "32APSK SERVICE_TYPE = {"-2": "Data", "1": "TV", "2": "Radio", "3": "Data", "10": "Radio", "22": "TV (H264)", "25": "TV (HD)", "31": "TV (UHD)"} +# Terrestrial +BANDWIDTH = {"0": "Auto", "1": "8Mhz", "2": "7Mhz", "3": "6Mhz"} + +T_MODULATION = {"0": "Auto", "1": "QPSK", "2": "QAM16", "3": "QAM64"} + +TRANSMISSION_MODE = {"0": "Auto", "1": "2k", "3": "8k"} + +GUARD_INTERVAL = {"0": "Auto", "1": "1/32", "2": "1/16", "3": "1/8", "4": "1/4"} + +HIERARCHY = {"0": "Auto", "1": "None", "2": "1", "3": "2", "4": "4"} + +T_FEC = {"0": "1/2", "1": "2/3", "2": "3/4", "3": "5/6", "4": "7/8", "5": "Auto", "6": "6/7", "7": "8/9"} + +# Cable +C_MODULATION = {"0": "Auto", "1": "QAM16", "2": "QAM32", "3": "QAM64", "4": "QAM128", "5": "QAM256"} + +# CAS CAS = {"C:2600": "BISS", "C:0b00": "Conax", "C:0b01": "Conax", "C:0b02": "Conax", "C:0baa": "Conax", "C:0602": "Irdeto", "C:0604": "Irdeto", "C:0606": "Irdeto", "C:0608": "Irdeto", "C:0622": "Irdeto", "C:0626": "Irdeto", "C:0664": "Irdeto", "C:0614": "Irdeto", "C:0692": "Irdeto", "C:1801": "Nagravision", "C:0500": "Viaccess", diff --git a/app/eparser/enigma/lamedb.py b/app/eparser/enigma/lamedb.py index 23109afc..5dcf5574 100644 --- a/app/eparser/enigma/lamedb.py +++ b/app/eparser/enigma/lamedb.py @@ -4,7 +4,7 @@ import re from app.commons import log from app.ui.uicommons import CODED_ICON, LOCKED_ICON, HIDE_ICON from .blacklist import get_blacklist -from ..ecommons import Service, POLARIZATION, FEC, SERVICE_TYPE, Flag +from ..ecommons import Service, POLARIZATION, FEC, SERVICE_TYPE, Flag, T_FEC, TrType _HEADER = "eDVB services /{}/" _SEP = ":" # separator @@ -220,23 +220,31 @@ def parse_services(services, transponders, path): if transponder is not None: tr_type, sp, tr = str(transponder).partition(" ") + tr_type = TrType(tr_type) tr = tr.split(_SEP) service_type = SERVICE_TYPE.get(data[4], SERVICE_TYPE["-2"]) # removing all non printable symbols! srv_name = "".join(c for c in ch[1] if c.isprintable()) + pol = POLARIZATION.get(tr[2], None) + fec = FEC.get(tr[3], None) + system = None + pos = None - if tr_type == "t": - system = "DVB-T" - pos = "T" - elif tr_type == "c": - system = "CABLE" - pos = "C" - else: + if tr_type is TrType.Satellite: system = "DVB-S2" if len(tr) > 7 else "DVB-S" pos = "{}.{}".format(tr[4][:-1], tr[4][-1:]) + if tr_type is TrType.Terrestrial: + system = "DVB-T" + pos = "T" + pol = None + fec = T_FEC.get(tr[3], None) + elif tr_type is TrType.Cable: + system = "DVB-C" + pos = "C" + pol = None channels.append(Service(flags_cas=ch[2], - transponder_type=tr_type, + transponder_type=tr_type.value, coded=coded, service=srv_name, locked=locked, @@ -248,8 +256,8 @@ def parse_services(services, transponders, path): ssid=data[0], freq=tr[0], rate=tr[1], - pol=POLARIZATION.get(tr[2], None), - fec=FEC[tr[3]], + pol=pol, + fec=fec, system=system, pos=pos, data_id=data_id,