Exemple #1
0
    def get_transponders_for_fly_sat(self, trs):
        """ Parsing transponders for FlySat """
        if self._rows:
            zeros = "000"
            for r in self._rows:
                if len(r) < 3:
                    continue
                data = r[2].split(" ")
                if len(data) != 2:
                    continue
                sr, fec = data
                data = r[1].split(" ")
                if len(data) < 3:
                    continue
                freq, pol, sys = data[0], data[1], data[2]
                sys = sys.split("/")
                if len(sys) != 2:
                    continue
                sys, mod = sys
                mod = "QPSK" if sys == "DVB-S" else mod

                tr = Transponder(freq + zeros, sr + zeros, pol, fec, sys, mod,
                                 None, None, None)
                if is_transponder_valid(tr):
                    trs.append(tr)
Exemple #2
0
    def get_transponders_for_lyng_sat(self, trs):
        """ Parsing transponders for LyngSat """
        frq_pol_pattern = re.compile("(\d{4,5}).*([RLHV])(.*\d$)")
        sr_fec_pattern = re.compile("^(\d{4,5})-(\d/\d)(.+PSK)?(.*)?$")
        sys_pattern = re.compile("(DVB-S[2]?)(.*)?")
        zeros = "000"
        for r in filter(lambda x: len(x) > 8, self._rows):
            freq = re.match(frq_pol_pattern, r[2])
            if not freq:
                continue
            frq, pol = freq.group(1), freq.group(2)
            sr_fec = re.match(sr_fec_pattern, r[-3])
            if not sr_fec:
                continue
            sr, fec, mod = sr_fec.group(1), sr_fec.group(2), sr_fec.group(3)
            mod = mod.strip() if mod else "Auto"
            sys = re.match(sys_pattern, r[-4])
            if not sys:
                continue
            sys = sys.group(1)

            tr = Transponder(frq + zeros, sr + zeros, pol, fec, sys, mod, None,
                             None, None)
            if is_transponder_valid(tr):
                trs.append(tr)
    def get_transponders_for_lyng_sat(self, trs):
        """ Parsing transponders for LyngSat. """
        frq_pol_pattern = re.compile("(\\d{4,5})\\s+([RLHV]).*")
        sr_fec_pattern = re.compile(
            r"(DVB-S[2]?)\s+(.+PSK)?.*?(\d+)\s+(\d/\d)\s*(?:T2-MI\s+PLP\s+(\d+))?.*"
        )
        zeros = "000"
        pls_mode, pls_code, pls_id = None, None, None

        for row in filter(lambda x: len(x) > 8, self._rows):
            for frq in row[1], row[2], row[3]:
                freq = re.match(frq_pol_pattern, frq)
                if freq:
                    break
            if not freq:
                continue

            frq, pol = freq.group(1), freq.group(2)
            srf = " ".join(row[3:5])
            sr_fec = re.search(sr_fec_pattern, srf)
            if not sr_fec:
                continue

            sys, mod, sr, fec = sr_fec.group(1), sr_fec.group(2), sr_fec.group(
                3), sr_fec.group(4)
            mod = mod.strip() if mod else "Auto"
            pls_id = sr_fec.group(5)

            tr = Transponder(frq + zeros, sr + zeros, pol, fec, sys, mod,
                             pls_mode, pls_code, pls_id)
            if is_transponder_valid(tr):
                trs.append(tr)
 def to_transponder(self):
     return Transponder(frequency=self._freq_entry.get_text(),
                        symbol_rate=self._rate_entry.get_text(),
                        polarization=self._pol_box.get_active_id(),
                        fec_inner=self._fec_box.get_active_id(),
                        system=self._sys_box.get_active_id(),
                        modulation=self._mod_box.get_active_id(),
                        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())
    def get_transponders_for_fly_sat(self, trs):
        """ Parsing transponders for FlySat """
        pls_pattern = re.compile("(PLS:)+ (Root|Gold|Combo)+ (\\d+)?")
        is_id_pattern = re.compile("(Stream) (\\d+)")
        pls_modes = {v: k for k, v in PLS_MODE.items()}
        n_trs = []

        if self._rows:
            zeros = "000"
            is_ids = []
            for r in self._rows:
                if len(r) == 1:
                    is_ids.extend(re.findall(is_id_pattern, r[0]))
                    continue
                if len(r) < 3:
                    continue
                data = r[2].split(" ")
                if len(data) != 2:
                    continue
                sr, fec = data
                data = r[1].split(" ")
                if len(data) < 3:
                    continue
                freq, pol, sys = data[0], data[1], data[2]
                sys = sys.split("/")
                if len(sys) != 2:
                    continue
                sys, mod = sys
                mod = "QPSK" if sys == "DVB-S" else mod

                pls = re.findall(pls_pattern, r[1])
                pls_code = None
                pls_mode = None

                if pls:
                    pls_code = pls[0][2]
                    pls_mode = pls_modes.get(pls[0][1], None)

                if is_ids:
                    tr = trs.pop()
                    for index, is_id in enumerate(is_ids):
                        tr = tr._replace(is_id=is_id[1])
                        if is_transponder_valid(tr):
                            n_trs.append(tr)
                else:
                    tr = Transponder(freq + zeros, sr + zeros, pol, fec, sys,
                                     mod, pls_mode, pls_code, None)
                    if is_transponder_valid(tr):
                        trs.append(tr)
                is_ids.clear()
            trs.extend(n_trs)
Exemple #6
0
    def get_transponders_for_fly_sat(self, trs):
        """ Parsing transponders for FlySat. """
        frq_pol_pattern = re.compile(
            r"(\d{4,5})+\s+([RLHV]).*(DVB-S[2]?)/(.+PSK)?.*")
        pls_pattern = re.compile(r".*PLS\s+(Root|Gold|Combo)+\s(\d+)?")
        is_id_pattern = re.compile(r"Stream\s(\d+)")
        sr_fec_pattern = re.compile(r"(\d{4,5})+\s+(\d+/\d+).*")
        n_trs = []

        if self._rows:
            is_ids = []
            for r in self._rows:
                row_len = len(r)
                if row_len == 1:
                    is_ids.extend(re.findall(is_id_pattern, r[0]))
                    continue
                if row_len < 12:
                    continue

                freq = re.findall(frq_pol_pattern, r[2])
                if not freq:
                    continue
                freq, pol, sys, mod = freq[0]

                sr_fec = re.match(sr_fec_pattern, r[3])
                if not sr_fec:
                    continue
                sr, fec = sr_fec.group(1), sr_fec.group(2)

                pls = re.match(pls_pattern, r[2])
                pls_code = None
                pls_mode = None
                if pls:
                    pls_mode = self.pls_modes.get(pls.group(1), None)
                    pls_code = pls.group(2)

                if is_ids:
                    tr = trs.pop()
                    for index, is_id in enumerate(is_ids):
                        tr = tr._replace(is_id=is_id)
                        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, None)
                if is_transponder_valid(tr):
                    trs.append(tr)

                is_ids.clear()
            trs.extend(n_trs)
Exemple #7
0
    def on_edit(self, view, force=False):
        """ Common edit """
        paths = self.check_selection(view, "Please, select only one item!")
        if not paths:
            return

        model = view.get_model()
        row = model[paths][:]
        itr = model.get_iter(paths)

        if view is self._satellite_view:
            self.on_satellite(None if force else Satellite(*row), itr)
        elif view is self._transponder_view:
            self.on_transponder(None if force else Transponder(*row), itr)
    def parse_data(model, path, itr, sats):
        if model.iter_has_child(itr):
            num_of_children = model.iter_n_children(itr)
            transponders = []
            num_columns = model.get_n_columns()

            for num in range(num_of_children):
                transponder_itr = model.iter_nth_child(itr, num)
                transponder = model.get(transponder_itr, *[item for item in range(num_columns)])
                transponders.append(Transponder(*transponder[1:-2]))

            sat = model.get(itr, *[item for item in range(num_columns)])
            satellite = Satellite(sat[0], sat[-2], sat[-1], transponders)
            sats.append(satellite)
    def on_edit(self, view, force=False):
        """ Common edit """
        paths = self.check_selection(view, "Please, select only one item!")
        if not paths:
            return

        model = view.get_model()
        itr = model.get_iter(paths[0])
        row = model.get(itr, *[x for x in range(view.get_n_columns())])

        if row[-1]:  # satellite
            self.on_satellite(None if force else Satellite(row[0], None, row[-1], None), itr)
        else:
            self.on_transponder(None if force else Transponder(*row[1:-2]), itr)
Exemple #10
0
    def get_transponders_for_king_of_sat(self, trs):
        """ Getting transponders for KingOfSat source.

            Since the *.ini file contains incomplete information, it is not used.
        """
        zeros = "000"
        pos_pat = re.compile(r".*?(\d+\.\d°[EW]).*")
        pat = re.compile(
            r"(\d+).00\s+([RLHV])\s+(DVB-S[2]?)\s+(?:T2-MI, PLP (\d+)\s+)?(.*PSK).*?(?:Stream\s+(\d+))?\s+(\d+)\s+(\d+/\d+)$")

        for row in filter(lambda r: len(r) == 16 and pos_pat.match(r[0]), self._rows):
            res = pat.search(" ".join((row[0], row[2], row[3], row[8], row[9], row[10])))
            if res:
                freq, sr, pol, fec, sys = res.group(1), res.group(7), res.group(2), res.group(8), res.group(3)
                mod, pls_id, pls_code = res.group(5), res.group(4), res.group(6)

                tr = Transponder(freq + zeros, sr + zeros, pol, fec, sys, mod, None, pls_code, pls_id)
                if is_transponder_valid(tr):
                    trs.append(tr)
Exemple #11
0
    def get_transponders_for_king_of_sat(self, trs):
        """ Getting transponders for KingOfSat source.

            Since the *.ini file contains incomplete information, it is not used.
        """
        sys_pat = re.compile(
            r"(DVB-S[2]?)\s?(?:T2-MI,\s+PLP\s+(\d+))?.*?(?:PLS:\s+(Root|Gold|Combo)\+(\d+))?"
        )
        mod_pat = re.compile(r"(.*PSK).*?(?:.*Stream\s+(\d+))?.*")
        sr_fec_pattern = re.compile(r"(\d{4,5})+\s+(\d+/\d+).*")

        for row in filter(lambda r: len(r) == 16 and self.POS_PAT.match(r[0]),
                          self._rows):
            freq, pol = row[2].replace(".", "0"), row[3]
            if not freq.isdigit() or pol not in "VHLR":
                continue

            res = re.match(sys_pat, row[8])
            if not res:
                continue
            sys, t2_mi, pls_id, pls_code = res.group(1), res.group(
                2), res.group(3), res.group(4)
            pls_id = self.pls_modes.get(pls_id, None)

            res = re.match(mod_pat, row[9])
            if not res:
                continue
            mod, is_id = res.group(1), res.group(2)

            res = re.match(sr_fec_pattern, row[10])
            if not res:
                continue
            sr, fec = res.group(1), res.group(2)

            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, None)
            if is_transponder_valid(tr):
                trs.append(tr)
Exemple #12
0
    def get_transponders_for_lyng_sat(self, trs):
        """ Parsing transponders for LyngSat. """
        frq_pol_pattern = re.compile(r"(\d{4,5})\s+([RLHV]).*")
        sr_fec_pattern = re.compile(
            (r"(DVB-S[2]?)\s+(.+PSK)?.*?(\d+)\s+(\d/\d)\s?"
             r"(?:T2-MI\s+PLP\s+(\d+))?.*"
             r"?(?:PLS\s+(Root|Gold|Combo)\s+(\d+))?"
             r"(?:.*Stream\s+(\d+))?.*"))

        for row in filter(lambda x: len(x) > 8, self._rows):
            for freq in row[1], row[2], row[3]:
                res = re.match(frq_pol_pattern, freq)
                if res:
                    break
            if not res:
                continue

            freq, pol = res.group(1), res.group(2)
            res = re.search(sr_fec_pattern, row[3])
            if not res:
                continue

            sys, mod, sr, fec = res.group(1), res.group(2), res.group(
                3), res.group(4)
            mod = mod.strip() if mod else "Auto"
            plp, pls_mode, pls_code, is_id = res.group(5), res.group(
                6), res.group(7), res.group(8)
            pls_mode = self.pls_modes.get(pls_mode, None)

            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, None)
            if is_transponder_valid(tr):
                trs.append(tr)
Exemple #13
0
    def get_transponders_for_lyng_sat(self, trs):
        """ Parsing transponders for LyngSat """
        frq_pol_pattern = re.compile("(\\d{4,5})\\s+([RLHV]).*")
        sr_fec_pattern = re.compile("^(\\d{4,5})-(\\d/\\d)(.+PSK)?(.*)?$")
        sys_pattern = re.compile("(DVB-S[2]?) ?(PLS+ (Root|Gold|Combo)+ (\\d+))* ?(multistream stream (\\d+))?",
                                 re.IGNORECASE)
        zeros = "000"
        pls_modes = {v: k for k, v in PLS_MODE.items()}

        for r in filter(lambda x: len(x) > 8, self._rows):
            for frq in r[1], r[2], r[3]:
                freq = re.match(frq_pol_pattern, frq)
                if freq:
                    break
            if not freq:
                continue
            frq, pol = freq.group(1), freq.group(2)
            sr_fec = re.match(sr_fec_pattern, r[-3])
            if not sr_fec:
                continue
            sr, fec, mod = sr_fec.group(1), sr_fec.group(2), sr_fec.group(3)
            mod = mod.strip() if mod else "Auto"

            res = re.match(sys_pattern, r[-4])
            if not res:
                continue

            sys = res.group(1)
            pls_mode = res.group(3)
            pls_mode = pls_modes.get(pls_mode.capitalize(), None) if pls_mode else pls_mode
            pls_code = res.group(4)
            pls_id = res.group(6)

            tr = Transponder(frq + zeros, sr + zeros, pol, fec, sys, mod, pls_mode, pls_code, pls_id)
            if is_transponder_valid(tr):
                trs.append(tr)