diff --git a/app/ui/dialogs.glade b/app/ui/dialogs.glade
index 7cbeb76d..0acba720 100644
--- a/app/ui/dialogs.glade
+++ b/app/ui/dialogs.glade
@@ -731,7 +731,7 @@ dmitry.v.yefremov@gmail.com
@@ -742,8 +742,10 @@ dmitry.v.yefremov@gmail.com
@@ -752,10 +754,10 @@ dmitry.v.yefremov@gmail.com
-
-
+
True
False
- Reference:
+ Reference
3
@@ -818,6 +822,7 @@ dmitry.v.yefremov@gmail.com
True
True
+ True
False
@@ -827,7 +832,7 @@ dmitry.v.yefremov@gmail.com
- False
+ True
True
1
@@ -917,7 +922,7 @@ dmitry.v.yefremov@gmail.com
True
False
- Service type
+ Type
0
@@ -972,8 +977,8 @@ dmitry.v.yefremov@gmail.com
True
True
- 10
- 10
+ 5
+ 5
gtk-edit
@@ -986,8 +991,8 @@ dmitry.v.yefremov@gmail.com
True
True
- 10
- 10
+ 5
+ 5
gtk-edit
@@ -1000,8 +1005,8 @@ dmitry.v.yefremov@gmail.com
True
True
- 10
- 10
+ 5
+ 5
gtk-edit
@@ -1014,8 +1019,8 @@ dmitry.v.yefremov@gmail.com
True
True
- 10
- 10
+ 5
+ 5
gtk-edit
@@ -1028,8 +1033,8 @@ dmitry.v.yefremov@gmail.com
True
True
- 10
- 10
+ 5
+ 5
gtk-edit
diff --git a/app/ui/iptv.py b/app/ui/iptv.py
index b19c9f79..cbb7262a 100644
--- a/app/ui/iptv.py
+++ b/app/ui/iptv.py
@@ -1,6 +1,6 @@
import re
-from app.eparser.iptv import NEUTRINO_FAV_ID_FORMAT
+from app.eparser.iptv import NEUTRINO_FAV_ID_FORMAT, StreamType, ENIGMA2_FAV_ID_FORMAT
from app.properties import Profile
from . import Gtk, Gdk, TEXT_DOMAIN, UI_RESOURCES_PATH
from .dialogs import Action, show_dialog, DialogType
@@ -8,8 +8,11 @@ from .main_helper import get_base_model
class IptvDialog:
- def __init__(self, transient, view=None, services=None, bouquets=None, profile=Profile.ENIGMA_2, action=Action.ADD):
- handlers = {"on_entry_changed": self.on_entry_changed, "on_save": self.on_save}
+ def __init__(self, transient, view, services, bouquet, profile=Profile.ENIGMA_2, action=Action.ADD):
+ handlers = {"on_entry_changed": self.on_entry_changed,
+ "on_save": self.on_save,
+ "on_stream_type_changed": self.on_stream_type_changed}
+
builder = Gtk.Builder()
builder.set_translation_domain(TEXT_DOMAIN)
builder.add_objects_from_file(UI_RESOURCES_PATH + "dialogs.glade", ("iptv_dialog", "stream_type_liststore"))
@@ -32,6 +35,8 @@ class IptvDialog:
self._stream_type_combobox = builder.get_object("stream_type_combobox")
self._action = action
self._profile = profile
+ self._bouquet = bouquet
+ self._services = services
self._model, self._paths = view.get_selection().get_selected_rows()
self._current_srv = get_base_model(self._model)[self._paths][:]
@@ -45,7 +50,12 @@ class IptvDialog:
if profile is Profile.NEUTRINO_MP:
builder.get_object("iptv_data_box").set_visible(False)
builder.get_object("iptv_type_label").set_visible(False)
+ builder.get_object("reference_entry").set_visible(False)
+ builder.get_object("iptv_reference_label").set_visible(False)
self._stream_type_combobox.set_visible(False)
+ else:
+ self._description_entry.set_visible(False)
+ builder.get_object("iptv_description_label").set_visible(False)
if self._action is Action.ADD:
self._save_button.set_visible(False)
@@ -61,7 +71,7 @@ class IptvDialog:
if show_dialog(DialogType.QUESTION, self._dialog) == Gtk.ResponseType.CANCEL:
return
- self.save_enigma2_data()if self._profile is Profile.ENIGMA_2 else self.save_neutrino_data()
+ self.save_enigma2_data() if self._profile is Profile.ENIGMA_2 else self.save_neutrino_data()
self._dialog.destroy()
def init_data(self, srv):
@@ -75,6 +85,7 @@ class IptvDialog:
data = data.split(":")
if len(data) < 12:
return
+ self._stream_type_combobox.set_active(0 if StreamType(data[0].strip()) is StreamType.DVB_TS else 1)
self._srv_type_entry.set_text(data[2])
self._sid_entry.set_text(data[3])
self._tr_id_entry.set_text(data[4])
@@ -98,7 +109,7 @@ class IptvDialog:
self._namespace_entry.get_text()))
def get_type(self):
- return 1
+ return 1 if self._stream_type_combobox.get_active() == 0 else 4097
def on_entry_changed(self, entry):
if self._pattern.search(entry.get_text()):
@@ -107,16 +118,32 @@ class IptvDialog:
entry.set_name("GtkEntry")
self._update_reference_entry()
+ def on_stream_type_changed(self, item):
+ self._update_reference_entry()
+
def save_enigma2_data(self):
- pass
+ name = self._name_entry.get_text().strip()
+ fav_id = ENIGMA2_FAV_ID_FORMAT.format(self.get_type(),
+ self._srv_type_entry.get_text(),
+ self._sid_entry.get_text(),
+ self._tr_id_entry.get_text(),
+ self._net_id_entry.get_text(),
+ self._namespace_entry.get_text(),
+ self._url_entry.get_text().replace(":", "%3a"),
+ name, name)
+ self.update_bouquet_data(name, fav_id)
def save_neutrino_data(self):
- name = self._name_entry.get_text()
+ id_data = self._current_srv[7].split("::")
+ id_data[0] = self._url_entry.get_text()
+ id_data[1] = self._description_entry.get_text()
+ self.update_bouquet_data(self._name_entry.get_text(), NEUTRINO_FAV_ID_FORMAT.format(*id_data))
+
+ def update_bouquet_data(self, name, fav_id):
if self._action is Action.EDIT:
- id_data = self._current_srv[7].split("::")
- id_data[0] = self._url_entry.get_text()
- id_data[1] = self._description_entry.get_text()
- fav_id = NEUTRINO_FAV_ID_FORMAT.format(*id_data)
+ old_srv = self._services.pop(self._current_srv[7])
+ self._services[fav_id] = old_srv._replace(service=name, fav_id=fav_id)
+ self._bouquet[self._paths[0][0]] = fav_id
self._model.set_value(self._model.get_iter(self._paths), 2, name)
diff --git a/app/ui/main_app_window.py b/app/ui/main_app_window.py
index e315e313..0d08d54e 100644
--- a/app/ui/main_app_window.py
+++ b/app/ui/main_app_window.py
@@ -936,7 +936,7 @@ class MainAppWindow:
return IptvDialog(self.__main_window,
self.__fav_view,
self.__services,
- self.__bouquets,
+ self.__bouquets.get(self.is_bouquet_selected(), None),
Profile(self.__profile),
Action.EDIT).show()
self.on_locate_in_services(view)
diff --git a/app/ui/main_helper.py b/app/ui/main_helper.py
index ae9fa068..4cf8a99a 100644
--- a/app/ui/main_helper.py
+++ b/app/ui/main_helper.py
@@ -59,7 +59,7 @@ def edit_marker(view, bouquets, selected_bouquet, channels, parent_window):
old_ch = 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})
- channels[new_fav_id] = Service(*old_ch[0:3], response, *old_ch[4:17], old_ch.data_id, new_fav_id, None)
+ channels[new_fav_id] = old_ch._replace(service=response, fav_id=new_fav_id)
bq_services.pop(index)
bq_services.insert(index, new_fav_id)
@@ -143,7 +143,7 @@ def rename(view, parent_window, target, fav_view=None, service_view=None, channe
old_ch = channels.get(f_id, None)
if old_ch:
- channels[f_id] = Service(*old_ch[0:3], channel_name, *old_ch[4:])
+ channels[f_id] = old_ch._replace(service=channel_name)
# ***************** Flags *******************#
@@ -196,7 +196,7 @@ def set_lock(blacklist, channels, model, paths, target, services_model):
continue
blacklist.discard(bq_id) if locked else blacklist.add(bq_id)
model.set_value(itr, col_num, None if locked else LOCKED_ICON)
- channels[fav_id] = Service(*channel[:4], None if locked else LOCKED_ICON, *channel[5:])
+ channels[fav_id] = channel._replace(locked=None if locked else LOCKED_ICON)
ids.append(fav_id)
if target is ViewTarget.FAV and ids:
@@ -244,7 +244,7 @@ def set_hide(channels, model, paths):
fav_id = model.get_value(itr, 18)
channel = channels.get(fav_id, None)
if channel:
- channels[fav_id] = Service(*channel[:5], None if hide else HIDE_ICON, *channel[6:])
+ channels[fav_id] = channel._replace(hide=None if hide else HIDE_ICON)
def has_locked_hide(model, paths, col_num):
diff --git a/app/ui/service_details_dialog.py b/app/ui/service_details_dialog.py
index ea0913ed..6dd55b4a 100644
--- a/app/ui/service_details_dialog.py
+++ b/app/ui/service_details_dialog.py
@@ -409,6 +409,7 @@ class ServiceDetailsDialog:
return self._old_service.fav_id, self._old_service.data_id
def get_fav_id(self):
+ """ TODO Needs implementation!!! """
if self._profile is Profile.ENIGMA_2:
return self._old_service.fav_id
elif self._profile is Profile.NEUTRINO_MP: