From 12a68a4dbbcfa5254f4ad00605410eeeaf96b963 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Wed, 15 Feb 2023 13:04:54 +0300 Subject: [PATCH] displaying parental lock for bouquets --- app/eparser/enigma/bouquets.py | 7 +++++-- app/eparser/neutrino/bouquets.py | 7 +++---- app/ui/main.py | 6 ++++++ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/app/eparser/enigma/bouquets.py b/app/eparser/enigma/bouquets.py index 48f62911..2b97442e 100644 --- a/app/eparser/enigma/bouquets.py +++ b/app/eparser/enigma/bouquets.py @@ -217,9 +217,12 @@ class BouquetsReader: rb_name = f"{rb_name} {real_b_names[rb_name]}" else: real_b_names[rb_name] = 0 - + # Locked, hidden. + s_data[:2] = "10" + locked = ":".join(s_data).rstrip() hidden = s_type is ServiceType.HIDDEN - bouquets[2].append(Bouquet(rb_name, bq_type, services, None, hidden, b_name)) + + bouquets[2].append(Bouquet(rb_name, bq_type, services, locked, hidden, b_name)) else: if len(s_data) == 12 and s_type is ServiceType.MARKER: b_name = f"{_MARKER_PREFIX}{s_data[-1].strip()}" diff --git a/app/eparser/neutrino/bouquets.py b/app/eparser/neutrino/bouquets.py index 71293465..d52ae50a 100644 --- a/app/eparser/neutrino/bouquets.py +++ b/app/eparser/neutrino/bouquets.py @@ -2,7 +2,7 @@ # # The MIT License (MIT) # -# Copyright (c) 2018-2021 Dmitriy Yefremov +# Copyright (c) 2018-2023 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 @@ -31,7 +31,6 @@ import os from app.eparser.iptv import NEUTRINO_FAV_ID_FORMAT from app.eparser.neutrino import KSP, SP, get_xml_attributes, get_attributes, API_VER from app.eparser.neutrino.nxml import XmlHandler, NeutrinoDocument -from app.ui.uicommons import LOCKED_ICON, HIDE_ICON from ..ecommons import Bouquets, Bouquet, BouquetService, BqServiceType, PROVIDER, BqType _FILE = "bouquets.xml" @@ -72,8 +71,8 @@ def parse_bouquets(file, name, bq_type): bouquets[2].append(Bouquet(name=bq_name, type=bq_type, services=services, - locked=LOCKED_ICON if locked == "1" else None, - hidden=HIDE_ICON if hidden == "1" else None, + locked=locked == "1", + hidden=hidden == "1", file=SP.join("{}{}{}".format(k, KSP, v) for k, v in bq_attrs.items()))) if BqType(bq_type) is BqType.BOUQUET: diff --git a/app/ui/main.py b/app/ui/main.py index 5f05ae7a..a8ba03c2 100644 --- a/app/ui/main.py +++ b/app/ui/main.py @@ -2329,6 +2329,12 @@ class Application(Gtk.Application): def append_bouquet(self, bq, parent): name, bq_type, locked, hidden = bq.name, bq.type, bq.locked, HIDE_ICON if bq.hidden else None + # Parental control state. + if self._s_type is SettingsType.ENIGMA_2: + locked = LOCKED_ICON if bq.locked in self._blacklist else None + else: + locked = LOCKED_ICON if bq.locked else None + bouquet = self._bouquets_model.append(parent, [name, locked, hidden, bq_type]) bq_id = f"{name}:{bq_type}" services = []