added lock support for iptv

This commit is contained in:
DYefremov
2020-07-18 20:55:15 +03:00
parent 4f6443e6e3
commit 3f65975ac2
2 changed files with 12 additions and 6 deletions

View File

@@ -1286,12 +1286,18 @@ class Application(Gtk.Application):
if s_type in (BqServiceType.MARKER, BqServiceType.IPTV, BqServiceType.SPACE): if s_type in (BqServiceType.MARKER, BqServiceType.IPTV, BqServiceType.SPACE):
icon = None icon = None
picon_id = None picon_id = None
data_id = srv.num
locked = None
if s_type is BqServiceType.IPTV: if s_type is BqServiceType.IPTV:
icon = IPTV_ICON icon = IPTV_ICON
id_data = fav_id.lstrip().split(":") fav_id_data = fav_id.lstrip().split(":")
picon_id = "{}_{}_{}_{}_{}_{}_{}_{}_{}_{}.png".format(*id_data[0:10]) if len(fav_id_data) > 10:
srv = Service(*agr[0:2], icon, srv.name, *agr[0:3], s_type.name, self._picons.get(picon_id, None), data_id = ":".join(fav_id_data[:11])
picon_id, *agr, srv.num, fav_id, None) picon_id = "{}_{}_{}_{}_{}_{}_{}_{}_{}_{}.png".format(*fav_id_data[:10])
locked = LOCKED_ICON if data_id in self._blacklist else None
srv = Service(None, None, icon, srv.name, locked, None, None, s_type.name,
self._picons.get(picon_id, None), picon_id, *agr, data_id, fav_id, None)
self._services[fav_id] = srv self._services[fav_id] = srv
elif srv.name: elif srv.name:
extra_services[fav_id] = srv.name extra_services[fav_id] = srv.name

View File

@@ -242,14 +242,14 @@ def set_lock(blacklist, services, model, paths, target, services_model):
locked = has_locked_hide(model, paths, col_num) locked = has_locked_hide(model, paths, col_num)
ids = [] ids = []
skip_type = {BqServiceType.IPTV.name, BqServiceType.MARKER.name, BqServiceType.SPACE.name} skip_type = {BqServiceType.MARKER.name, BqServiceType.SPACE.name}
for path in paths: for path in paths:
itr = model.get_iter(path) itr = model.get_iter(path)
fav_id = model.get_value(itr, Column.SRV_FAV_ID if target is ViewTarget.SERVICES else Column.FAV_ID) fav_id = model.get_value(itr, Column.SRV_FAV_ID if target is ViewTarget.SERVICES else Column.FAV_ID)
srv = services.get(fav_id, None) srv = services.get(fav_id, None)
if srv and srv.service_type not in skip_type: if srv and srv.service_type not in skip_type:
bq_id = to_bouquet_id(srv) bq_id = srv.data_id if srv.service_type == BqServiceType.IPTV.name else to_bouquet_id(srv)
if not bq_id: if not bq_id:
continue continue
blacklist.discard(bq_id) if locked else blacklist.add(bq_id) blacklist.discard(bq_id) if locked else blacklist.add(bq_id)