mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2025-12-21 16:09:41 +01:00
added URL column to IPTV view (#92)
This commit is contained in:
@@ -488,10 +488,14 @@ Author: Dmitriy Yefremov
|
||||
<column type="GdkPixbuf"/>
|
||||
<!-- column-name ref -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name url -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name fav_id -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name picon_id -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name extra -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkTreeModelFilter" id="iptv_services_model_filter">
|
||||
@@ -2754,7 +2758,7 @@ Author: Dmitriy Yefremov
|
||||
<property name="fixed_height_mode">True</property>
|
||||
<property name="rubber_banding">True</property>
|
||||
<property name="enable_grid_lines">both</property>
|
||||
<property name="tooltip_column">3</property>
|
||||
<property name="tooltip_column">7</property>
|
||||
<property name="activate_on_single_click">True</property>
|
||||
<signal name="button-press-event" handler="on_view_popup_menu" object="iptv_popup_menu" swapped="no"/>
|
||||
<signal name="button-press-event" handler="on_view_press" swapped="no"/>
|
||||
@@ -2776,7 +2780,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="sizing">fixed</property>
|
||||
<property name="min_width">170</property>
|
||||
<property name="title" translatable="yes">Service</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="alignment">0.5</property>
|
||||
<property name="sort_column_id">0</property>
|
||||
@@ -2796,7 +2799,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="sizing">fixed</property>
|
||||
<property name="min_width">100</property>
|
||||
<property name="title" translatable="yes">Type</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="alignment">0.5</property>
|
||||
<property name="sort_column_id">1</property>
|
||||
@@ -2815,7 +2817,6 @@ Author: Dmitriy Yefremov
|
||||
<property name="sizing">fixed</property>
|
||||
<property name="min_width">25</property>
|
||||
<property name="title" translatable="yes">Picon</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="alignment">0.5</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererPixbuf" id="iptv_picon_renderer">
|
||||
@@ -2829,10 +2830,10 @@ Author: Dmitriy Yefremov
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="iptv_ref_column">
|
||||
<property name="resizable">True</property>
|
||||
<property name="sizing">fixed</property>
|
||||
<property name="min_width">150</property>
|
||||
<property name="title" translatable="yes">Reference</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="alignment">0.5</property>
|
||||
<property name="sort_column_id">3</property>
|
||||
@@ -2846,6 +2847,27 @@ Author: Dmitriy Yefremov
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn" id="iptv_url_column">
|
||||
<property name="resizable">True</property>
|
||||
<property name="sizing">fixed</property>
|
||||
<property name="min_width">150</property>
|
||||
<property name="title" translatable="yes">URL</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="clickable">True</property>
|
||||
<property name="alignment">0.5</property>
|
||||
<property name="sort_column_id">3</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="iptv_url_renderer">
|
||||
<property name="xpad">5</property>
|
||||
<property name="ellipsize">end</property>
|
||||
</object>
|
||||
<attributes>
|
||||
<attribute name="text">4</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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 """
|
||||
|
||||
Reference in New Issue
Block a user