mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2026-03-10 22:51:05 +01:00
IPTV tab update after EPG configuration (#132)
This commit is contained in:
@@ -365,7 +365,7 @@ class EpgTool(Gtk.Box):
|
||||
|
||||
class EpgDialog:
|
||||
|
||||
def __init__(self, app, bouquet, bouquet_name):
|
||||
def __init__(self, app, bouquet_name):
|
||||
|
||||
handlers = {"on_close_dialog": self.on_close_dialog,
|
||||
"on_apply": self.on_apply,
|
||||
@@ -398,7 +398,6 @@ class EpgDialog:
|
||||
self._ex_services = self._app.current_services
|
||||
self._ex_fav_model = self._app.fav_view.get_model()
|
||||
self._settings = self._app.app_settings
|
||||
self._bouquet = bouquet
|
||||
self._bouquet_name = bouquet_name
|
||||
self._current_ref = []
|
||||
self._enable_dat_filter = False
|
||||
@@ -475,15 +474,20 @@ class EpgDialog:
|
||||
if show_dialog(DialogType.QUESTION, self._dialog) != Gtk.ResponseType.OK:
|
||||
return
|
||||
|
||||
updated = {}
|
||||
for i, row in enumerate(self._bouquet_model):
|
||||
fav_id = row[Column.FAV_ID]
|
||||
if row[Column.FAV_LOCKED]:
|
||||
srv = self._ex_services.pop(self._ex_fav_model[row.path][Column.FAV_ID], None)
|
||||
fav_id = self._ex_fav_model[row.path][Column.FAV_ID]
|
||||
srv = self._ex_services.pop(fav_id, None)
|
||||
if srv:
|
||||
new_fav_id = row[Column.FAV_ID]
|
||||
picon_id = row[Column.FAV_POS] or srv.picon_id
|
||||
self._ex_services[fav_id] = srv._replace(fav_id=fav_id, data_id=fav_id.strip(), picon_id=picon_id)
|
||||
self._ex_fav_model[row.path][Column.FAV_ID] = fav_id
|
||||
self._bouquet[i] = fav_id
|
||||
new = srv._replace(fav_id=new_fav_id, data_id=new_fav_id.strip(), picon_id=picon_id)
|
||||
self._ex_services[new_fav_id] = new
|
||||
updated[fav_id] = (srv, new)
|
||||
|
||||
if updated:
|
||||
self._app.emit("iptv-service-edited", updated)
|
||||
|
||||
self._dialog.destroy()
|
||||
|
||||
|
||||
@@ -329,7 +329,7 @@ class IptvDialog:
|
||||
old_srv = services.pop(self._current_srv.fav_id)
|
||||
new_service = old_srv._replace(service=name, fav_id=fav_id, picon_id=picon_id)
|
||||
services[fav_id] = new_service
|
||||
self._app.emit("iptv-service-edited", (old_srv, new_service))
|
||||
self._app.emit("iptv-service-edited", {self._current_srv.fav_id: (old_srv, new_service)})
|
||||
else:
|
||||
aggr = [None] * 8
|
||||
s_type = BqServiceType.IPTV.name
|
||||
|
||||
@@ -2940,22 +2940,26 @@ class Application(Gtk.Application):
|
||||
log(f"Error. Service with id '{fav_id}' not found!")
|
||||
|
||||
@run_idle
|
||||
def on_iptv_service_edited(self, app, services):
|
||||
old, new = services
|
||||
fav_id = old.fav_id
|
||||
name, new_fav_id = new.service, new.fav_id
|
||||
def on_iptv_service_edited(self, app, services: dict):
|
||||
for srvs in self._bouquets.values():
|
||||
for i, s in enumerate(srvs):
|
||||
if s == fav_id:
|
||||
if s in services:
|
||||
old, new = services[s]
|
||||
srvs[i] = new.fav_id
|
||||
|
||||
for r in self._fav_model:
|
||||
if r[Column.FAV_ID] == fav_id:
|
||||
fav_id = r[Column.FAV_ID]
|
||||
if fav_id in services:
|
||||
old, new = services[fav_id]
|
||||
name, new_fav_id = new.service, new.fav_id
|
||||
r[Column.FAV_SERVICE] = name
|
||||
r[Column.FAV_ID] = new_fav_id
|
||||
|
||||
for r in self._iptv_model:
|
||||
if r[Column.IPTV_FAV_ID] == fav_id:
|
||||
fav_id = r[Column.IPTV_FAV_ID]
|
||||
if fav_id in services:
|
||||
old, new = services[fav_id]
|
||||
name, new_fav_id = new.service, new.fav_id
|
||||
ref, url = get_iptv_data(new_fav_id)
|
||||
r[Column.IPTV_SERVICE] = name
|
||||
r[Column.IPTV_PICON_ID] = new.picon_id
|
||||
@@ -3029,7 +3033,7 @@ class Application(Gtk.Application):
|
||||
picon_id_data[2:7] = ref_data[2:7]
|
||||
new_service = old_srv._replace(data_id=new_data_id, fav_id=new_fav_id, picon_id="_".join(picon_id_data))
|
||||
self._services[new_fav_id] = new_service
|
||||
self.emit("iptv-service-edited", (old_srv, new_service))
|
||||
self.emit("iptv-service-edited", {fav_id: (old_srv, new_service)})
|
||||
|
||||
# ****************** EPG ********************** #
|
||||
|
||||
@@ -3050,8 +3054,7 @@ class Application(Gtk.Application):
|
||||
self.show_error_message("This list does not contains IPTV streams!")
|
||||
return
|
||||
|
||||
bq = self._bouquets.get(self._bq_selected)
|
||||
EpgDialog(self, bq, self._current_bq_name).show()
|
||||
EpgDialog(self, self._current_bq_name).show()
|
||||
|
||||
# ***************** Import ******************** #
|
||||
|
||||
|
||||
Reference in New Issue
Block a user