mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2025-12-22 00:19:40 +01:00
marker edit impl
This commit is contained in:
@@ -15,7 +15,7 @@ class BqServiceType(Enum):
|
|||||||
|
|
||||||
Bouquet = namedtuple("Bouquet", ["name", "type", "services"])
|
Bouquet = namedtuple("Bouquet", ["name", "type", "services"])
|
||||||
Bouquets = namedtuple("Bouquets", ["name", "type", "bouquets"])
|
Bouquets = namedtuple("Bouquets", ["name", "type", "bouquets"])
|
||||||
BouquetService = namedtuple("BouquetService", ["name", "type", "data"])
|
BouquetService = namedtuple("BouquetService", ["name", "type", "data", "num"])
|
||||||
|
|
||||||
|
|
||||||
def get_bouquets(path):
|
def get_bouquets(path):
|
||||||
@@ -46,7 +46,7 @@ def write_bouquet(path, name, bq_type, channels):
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
if ch.service_type == BqServiceType.IPTV.name or ch.service_type == BqServiceType.MARKER.name:
|
if ch.service_type == BqServiceType.IPTV.name or ch.service_type == BqServiceType.MARKER.name:
|
||||||
bouquet.append("#SERVICE {}".format(ch.fav_id))
|
bouquet.append("#SERVICE {}\n".format(ch.fav_id.strip()))
|
||||||
else:
|
else:
|
||||||
bouquet.append("#SERVICE {}\n".format(to_bouquet_id(ch)))
|
bouquet.append("#SERVICE {}\n".format(to_bouquet_id(ch)))
|
||||||
|
|
||||||
@@ -76,12 +76,12 @@ def get_bouquet(path, name, bq_type):
|
|||||||
for ch in list(filter(lambda x: len(x) > 1, chs_list.split("#SERVICE")[1:])): # filtering ['']
|
for ch in list(filter(lambda x: len(x) > 1, chs_list.split("#SERVICE")[1:])): # filtering ['']
|
||||||
ch_data = ch.strip().split(":")
|
ch_data = ch.strip().split(":")
|
||||||
if ch_data[1] == "64":
|
if ch_data[1] == "64":
|
||||||
services.append(BouquetService(ch_data[-1].split("\n")[0], BqServiceType.MARKER, ch))
|
services.append(BouquetService(ch_data[-1].split("\n")[0], BqServiceType.MARKER, ch, ch_data[2]))
|
||||||
elif "http" in ch:
|
elif "http" in ch:
|
||||||
services.append(BouquetService(ch_data[-1].split("\n")[0], BqServiceType.IPTV, ch))
|
services.append(BouquetService(ch_data[-1].split("\n")[0], BqServiceType.IPTV, ch, 0))
|
||||||
else:
|
else:
|
||||||
services.append(BouquetService(None, BqServiceType.DEFAULT,
|
services.append(BouquetService(None, BqServiceType.DEFAULT,
|
||||||
"{}:{}:{}:{}".format(ch_data[3], ch_data[4], ch_data[5], ch_data[6])))
|
"{}:{}:{}:{}".format(ch_data[3], ch_data[4], ch_data[5], ch_data[6]), 0))
|
||||||
|
|
||||||
return services
|
return services
|
||||||
|
|
||||||
|
|||||||
@@ -460,16 +460,18 @@ class MainAppWindow:
|
|||||||
name, bt_type = bt.name, bt.type
|
name, bt_type = bt.name, bt.type
|
||||||
self.__bouquets_model.append(parent, [name, bt_type])
|
self.__bouquets_model.append(parent, [name, bt_type])
|
||||||
services = []
|
services = []
|
||||||
agr = [None] * 8
|
agr = [None] * 7
|
||||||
for srv in bt.services:
|
for srv in bt.services:
|
||||||
f_id = srv.data
|
fav_id = srv.data
|
||||||
# IPTV and MARKER services
|
# IPTV and MARKER services
|
||||||
s_type = srv.type
|
s_type = srv.type
|
||||||
if s_type is BqServiceType.MARKER:
|
if s_type is BqServiceType.MARKER:
|
||||||
self.__channels[f_id] = Channel(*agr[0:3], srv.name, *agr[0:3], s_type.name, *agr, f_id, None)
|
self.__channels[fav_id] = Channel(*agr[0:3], srv.name, *agr[0:3],
|
||||||
|
s_type.name, *agr, srv.num, fav_id, None)
|
||||||
elif s_type is BqServiceType.IPTV:
|
elif s_type is BqServiceType.IPTV:
|
||||||
self.__channels[f_id] = Channel(*agr[0:3], srv.name, *agr[0:3], srv.type.name, *agr, f_id, None)
|
self.__channels[fav_id] = Channel(*agr[0:3], srv.name, *agr[0:3],
|
||||||
services.append(f_id)
|
srv.type.name, *agr, srv.num, fav_id, None)
|
||||||
|
services.append(fav_id)
|
||||||
self.__bouquets["{}:{}".format(name, bt_type)] = services
|
self.__bouquets["{}:{}".format(name, bt_type)] = services
|
||||||
|
|
||||||
def append_services(self, data_path):
|
def append_services(self, data_path):
|
||||||
@@ -766,10 +768,21 @@ class MainAppWindow:
|
|||||||
|
|
||||||
def on_edit_marker(self, view):
|
def on_edit_marker(self, view):
|
||||||
model, paths = view.get_selection().get_selected_rows()
|
model, paths = view.get_selection().get_selected_rows()
|
||||||
response = show_dialog(DialogType.INPUT, self.__main_window, text=model.get_value(model.get_iter(paths[0]), 2))
|
itr = model.get_iter(paths[0])
|
||||||
|
name, fav_id = model.get(itr, 2, 7)
|
||||||
|
response = show_dialog(DialogType.INPUT, self.__main_window, text=name)
|
||||||
if response == Gtk.ResponseType.CANCEL:
|
if response == Gtk.ResponseType.CANCEL:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
bq_services = self.__bouquets[self.is_bouquet_selected()]
|
||||||
|
index = bq_services.index(fav_id)
|
||||||
|
old_ch = self.__channels.pop(fav_id, None)
|
||||||
|
new_fav_id = "{}::{}\n#DESCRIPTION {}\n".format(fav_id.split("::")[0], response, response)
|
||||||
|
model.set(itr, {2: response, 7: new_fav_id})
|
||||||
|
self.__channels[new_fav_id] = Channel(*old_ch[0:3], response, *old_ch[4:15], old_ch.data_id, new_fav_id, None)
|
||||||
|
bq_services.pop(index)
|
||||||
|
bq_services.insert(index, new_fav_id)
|
||||||
|
|
||||||
@run_idle
|
@run_idle
|
||||||
def on_fav_popup(self, view, event):
|
def on_fav_popup(self, view, event):
|
||||||
model, paths = view.get_selection().get_selected_rows()
|
model, paths = view.get_selection().get_selected_rows()
|
||||||
|
|||||||
Reference in New Issue
Block a user