diff --git a/app/ui/main.glade b/app/ui/main.glade index 3e695aeb..21a232d3 100644 --- a/app/ui/main.glade +++ b/app/ui/main.glade @@ -488,10 +488,14 @@ Author: Dmitriy Yefremov + + + + @@ -2754,7 +2758,7 @@ Author: Dmitriy Yefremov True True both - 3 + 7 True @@ -2776,7 +2780,6 @@ Author: Dmitriy Yefremov fixed 170 Service - True True 0.5 0 @@ -2796,7 +2799,6 @@ Author: Dmitriy Yefremov fixed 100 Type - True True 0.5 1 @@ -2815,7 +2817,6 @@ Author: Dmitriy Yefremov fixed 25 Picon - True 0.5 @@ -2829,10 +2830,10 @@ Author: Dmitriy Yefremov + True fixed 150 Reference - True True 0.5 3 @@ -2846,6 +2847,27 @@ Author: Dmitriy Yefremov + + + True + fixed + 150 + URL + True + True + 0.5 + 3 + + + 5 + end + + + 4 + + + + diff --git a/app/ui/main.py b/app/ui/main.py index d5190368..995a53ee 100644 --- a/app/ui/main.py +++ b/app/ui/main.py @@ -505,8 +505,6 @@ class Application(Gtk.Application): self._dvb_button = builder.get_object("dvb_button") iptv_type_column = builder.get_object("iptv_type_column") iptv_type_column.set_cell_data_func(builder.get_object("iptv_type_renderer"), self.iptv_type_data_func) - iptv_ref_column = builder.get_object("iptv_ref_column") - iptv_ref_column.set_cell_data_func(builder.get_object("iptv_ref_renderer"), self.iptv_ref_data_func) iptv_button = builder.get_object("iptv_button") iptv_button.bind_property("active", self._filter_services_button, "visible", 4) iptv_button.bind_property("active", self._srv_search_button, "visible", 4) @@ -1040,10 +1038,6 @@ class Application(Gtk.Application): f_data = fav_id.split(":", maxsplit=1) renderer.set_property("text", f"{StreamType(f_data[0].strip() if f_data else '0').name}") - def iptv_ref_data_func(self, column, renderer, model, itr, data): - p_id = model.get_value(itr, Column.IPTV_PICON_ID) - renderer.set_property("text", p_id.rstrip(".png").replace("_", ":") if p_id else None) - def iptv_picon_data_func(self, column, renderer, model, itr, data): renderer.set_property("pixbuf", self._picons.get(model.get_value(itr, Column.IPTV_PICON_ID))) @@ -2252,11 +2246,10 @@ class Application(Gtk.Application): def append_iptv_data(self, services=None): self._iptv_services_load_spinner.start() services = services or self._services.values() - services = ((s.service, None, None, None, s.fav_id, s.picon_id) for s in services if - s.service_type == BqServiceType.IPTV.name) - for index, s in enumerate(services, start=1): - self._iptv_model.append(s) + for index, s in enumerate(filter(lambda x: x.service_type == BqServiceType.IPTV.name, services), start=1): + ref, url = get_iptv_data(s.fav_id) + self._iptv_model.append((s.service, None, None, ref, url, s.fav_id, s.picon_id, None)) if index % self.DEL_FACTOR == 0: self._iptv_count_label.set_text(str(index)) yield True @@ -2861,7 +2854,10 @@ class Application(Gtk.Application): for r in self._iptv_model: if r[Column.IPTV_FAV_ID] == fav_id: + ref, url = get_iptv_data(new_fav_id) r[Column.IPTV_SERVICE] = name + r[Column.IPTV_REF] = ref + r[Column.IPTV_URL] = url r[Column.IPTV_FAV_ID] = new_fav_id @run_idle diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py index 6ce00b43..34026452 100644 --- a/app/ui/main_helper.py +++ b/app/ui/main_helper.py @@ -32,7 +32,7 @@ __all__ = ("insert_marker", "move_items", "rename", "ViewTarget", "set_flags", " "scroll_to", "get_base_model", "copy_picon_reference", "assign_picons", "remove_picon", "is_only_one_item_selected", "gen_bouquets", "BqGenType", "get_selection", "get_model_data", "remove_all_unused_picons", "get_picon_pixbuf", "get_base_itrs", "get_iptv_url", - "update_entry_data", "append_text_to_tview", "on_popup_menu") + "get_iptv_data", "update_entry_data", "append_text_to_tview", "on_popup_menu") import os import shutil @@ -696,6 +696,15 @@ def get_iptv_url(row, s_type, column=Column.FAV_ID): return unquote(url) if s_type is SettingsType.ENIGMA_2 else url +def get_iptv_data(fav_id): + """ Returns the reference and URL as a tuple from the fav_id. """ + data, sep, desc = fav_id.partition("#DESCRIPTION") + data = data.split(":") + if len(data) < 11: + return None, None, desc + return ":".join(data[:10]), unquote(data[10].strip()) + + def on_popup_menu(menu, event): """ Shows popup menu for the view """ if event.get_event_type() == Gdk.EventType.BUTTON_PRESS and event.button == Gdk.BUTTON_SECONDARY: diff --git a/app/ui/uicommons.py b/app/ui/uicommons.py index 170b6aef..10b9dd16 100644 --- a/app/ui/uicommons.py +++ b/app/ui/uicommons.py @@ -265,8 +265,10 @@ class Column(IntEnum): IPTV_TYPE = 1 IPTV_PICON = 2 IPTV_REF = 3 - IPTV_FAV_ID = 4 - IPTV_PICON_ID = 5 + IPTV_URL = 4 + IPTV_FAV_ID = 5 + IPTV_PICON_ID = 6 + IPTV_TOOLTIP = 7 def __index__(self): """ Overridden to get the index in slices directly """