mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2025-12-21 07:59:40 +01:00
alternatives improvement
* Added display of IPTV services.
This commit is contained in:
@@ -2459,36 +2459,27 @@ class Application(Gtk.Application):
|
|||||||
bouquet = self._bouquets_model.append(parent, [name, locked, hidden, bq_type])
|
bouquet = self._bouquets_model.append(parent, [name, locked, hidden, bq_type])
|
||||||
bq_id = f"{name}:{bq_type}"
|
bq_id = f"{name}:{bq_type}"
|
||||||
services = []
|
services = []
|
||||||
extra_services = {} # for services with different names in bouquet and main list
|
extra_services = {} # For services with different names in the bouquet and main list.
|
||||||
agr = [None] * 7
|
agr = [None] * 7
|
||||||
for srv in bq.services:
|
for srv in bq.services:
|
||||||
fav_id = srv.data
|
fav_id = srv.data
|
||||||
# IPTV and MARKER services
|
|
||||||
s_type = srv.type
|
s_type = srv.type
|
||||||
if s_type in (BqServiceType.MARKER, BqServiceType.IPTV, BqServiceType.SPACE):
|
# Markers and spaces.
|
||||||
icon = None
|
if s_type in (BqServiceType.MARKER, BqServiceType.SPACE):
|
||||||
picon_id = None
|
self._services[fav_id] = Service(None, None, None, srv.name, None, None, None,
|
||||||
data_id = srv.num
|
s_type.name, None, None, *agr, srv.num, fav_id, None)
|
||||||
locked = None
|
# IPTV services.
|
||||||
|
elif s_type is BqServiceType.IPTV:
|
||||||
if s_type is BqServiceType.IPTV:
|
self._services[fav_id] = self.get_bq_iptv_service(srv, agr)
|
||||||
fav_id_data = fav_id.lstrip().split(":")
|
# Alternatives.
|
||||||
if len(fav_id_data) > 10:
|
|
||||||
data_id = ":".join(fav_id_data[:11])
|
|
||||||
picon_id = "{}_{}_{}_{}_{}_{}_{}_{}_{}_{}.png".format(*fav_id_data[:10])
|
|
||||||
icon = LINK_ICON if data_id in self._stream_relay else IPTV_ICON
|
|
||||||
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
|
|
||||||
elif s_type is BqServiceType.ALT:
|
elif s_type is BqServiceType.ALT:
|
||||||
self._alt_file.add(f"{srv.data}:{bq_type}")
|
self._alt_file.add(f"{srv.data}:{bq_type}")
|
||||||
srv = Service(None, None, None, srv.name, locked, None, None, s_type.name,
|
self._services[fav_id] = Service(None, None, None, srv.name, locked, None, None, s_type.name,
|
||||||
None, None, *agr, srv.data, fav_id, srv.num)
|
None, None, *agr, srv.data, fav_id, srv.num)
|
||||||
self._services[fav_id] = srv
|
for s in filter(lambda x: x.type is BqServiceType.IPTV, srv[-1]):
|
||||||
|
iptv_srv = self.get_bq_iptv_service(s, agr)
|
||||||
|
self._services[iptv_srv.fav_id] = iptv_srv
|
||||||
elif s_type is BqServiceType.BOUQUET:
|
elif s_type is BqServiceType.BOUQUET:
|
||||||
# Sub bouquets!
|
|
||||||
self.append_bouquet(srv.data, bouquet)
|
self.append_bouquet(srv.data, bouquet)
|
||||||
elif srv.name:
|
elif srv.name:
|
||||||
extra_services[fav_id] = srv.name
|
extra_services[fav_id] = srv.name
|
||||||
@@ -2499,6 +2490,24 @@ class Application(Gtk.Application):
|
|||||||
if extra_services:
|
if extra_services:
|
||||||
self._extra_bouquets[bq_id] = extra_services
|
self._extra_bouquets[bq_id] = extra_services
|
||||||
|
|
||||||
|
def get_bq_iptv_service(self, srv, agr):
|
||||||
|
fav_id = srv.data
|
||||||
|
data_id = srv.num
|
||||||
|
picon_id = None
|
||||||
|
icon = None
|
||||||
|
locked = None
|
||||||
|
|
||||||
|
fav_id_data = fav_id.lstrip().split(":")
|
||||||
|
|
||||||
|
if len(fav_id_data) > 10:
|
||||||
|
data_id = ":".join(fav_id_data[:11])
|
||||||
|
picon_id = "{}_{}_{}_{}_{}_{}_{}_{}_{}_{}.png".format(*fav_id_data[:10])
|
||||||
|
icon = LINK_ICON if data_id in self._stream_relay else IPTV_ICON
|
||||||
|
locked = LOCKED_ICON if data_id in self._blacklist else None
|
||||||
|
|
||||||
|
return Service(None, None, icon, srv.name, locked, None, None, srv.type.name,
|
||||||
|
self._picons.get(picon_id, None), picon_id, *agr, data_id, fav_id, None)
|
||||||
|
|
||||||
@run_idle
|
@run_idle
|
||||||
def open_last_bouquet(self, app, profile):
|
def open_last_bouquet(self, app, profile):
|
||||||
""" Loads the last opened bouquet. """
|
""" Loads the last opened bouquet. """
|
||||||
|
|||||||
Reference in New Issue
Block a user