diff --git a/app/ui/service_details_dialog.glade b/app/ui/service_details_dialog.glade index 6f30b910..cc8d4e86 100644 --- a/app/ui/service_details_dialog.glade +++ b/app/ui/service_details_dialog.glade @@ -358,7 +358,7 @@ Author: Dmitriy Yefremov 5 5 vertical - 2 + 5 True @@ -379,6 +379,7 @@ Author: Dmitriy Yefremov True True + document-edit-symbolic 0 @@ -400,7 +401,7 @@ Author: Dmitriy Yefremov True True - + document-edit-symbolic 1 @@ -424,7 +425,7 @@ Author: Dmitriy Yefremov True 10 10 - + document-edit-symbolic @@ -469,7 +470,7 @@ Author: Dmitriy Yefremov True 7 7 - + document-edit-symbolic @@ -819,10 +820,14 @@ Author: Dmitriy Yefremov True False + 10 True False + center + 5 + 10 2 @@ -895,6 +900,47 @@ Author: Dmitriy Yefremov 0 + + + True + False + 2 + + + True + False + Extra: + + + False + True + 0 + + + + + True + True + 20 + 20 + document-edit-symbolic + c:000000,etc. + + + + False + True + 1 + + + + + False + True + end + 1 + + True @@ -905,9 +951,9 @@ Author: Dmitriy Yefremov True True C:0000,C:a1b2,etc. - 15 - 26 - + 20 + 20 + document-edit-symbolic C:0000,C:a1b2,etc. @@ -932,7 +978,7 @@ Author: Dmitriy Yefremov False True end - 1 + 2 @@ -1010,7 +1056,7 @@ Author: Dmitriy Yefremov True 12 12 - + document-edit-symbolic @@ -1036,7 +1082,7 @@ Author: Dmitriy Yefremov True 12 12 - + document-edit-symbolic @@ -1115,7 +1161,7 @@ Author: Dmitriy Yefremov True 12 12 - + document-edit-symbolic @@ -1153,7 +1199,7 @@ Author: Dmitriy Yefremov True 8 10 - + document-edit-symbolic @@ -1180,7 +1226,7 @@ Author: Dmitriy Yefremov True 8 10 - + document-edit-symbolic @@ -1389,7 +1435,7 @@ Author: Dmitriy Yefremov True 8 10 - + document-edit-symbolic @@ -1415,7 +1461,7 @@ Author: Dmitriy Yefremov True 8 10 - + document-edit-symbolic @@ -1441,7 +1487,7 @@ Author: Dmitriy Yefremov True 8 10 - + document-edit-symbolic @@ -1567,7 +1613,7 @@ Author: Dmitriy Yefremov - False + True False 10 document-edit-symbolic diff --git a/app/ui/service_details_dialog.py b/app/ui/service_details_dialog.py index 7b2b9f21..2dc283b8 100644 --- a/app/ui/service_details_dialog.py +++ b/app/ui/service_details_dialog.py @@ -1,3 +1,31 @@ +# -*- coding: utf-8 -*- +# +# The MIT License (MIT) +# +# Copyright (c) 2018-2021 Dmitriy Yefremov +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. +# +# Author: Dmitriy Yefremov +# + + import os import re @@ -42,6 +70,7 @@ class ServiceDetailsDialog: "on_tr_edit_toggled": self.on_tr_edit_toggled, "update_reference": self.update_reference, "on_cas_entry_changed": self.on_cas_entry_changed, + "on_extra_pids_entry_changed": self.on_extra_pids_entry_changed, "on_digit_entry_changed": self.on_digit_entry_changed, "on_non_empty_entry_changed": self.on_non_empty_entry_changed, "on_cancel": lambda item: self._dialog.destroy()} @@ -69,6 +98,7 @@ class ServiceDetailsDialog: self._DIGIT_PATTERN = re.compile("\\D") self._NON_EMPTY_PATTERN = re.compile("(?:^[\\s]*$|\\D)") self._CAID_PATTERN = re.compile("(?:^[\\s]*$)|(C:[0-9a-fA-F]{1,4})(,C:[0-9a-fA-F]{1,4})*") + self._PIDS_PATTERN = re.compile("(?:^[\\s]*$)|(c:[0-9]{2}[0-9a-fA-F]{4})(,c:[0-9]{2}[0-9a-fA-F]{4})*") # Buttons self._apply_button = builder.get_object("apply_button") self._create_button = builder.get_object("create_button") @@ -104,6 +134,7 @@ class ServiceDetailsDialog: self._stream_id_entry = self._digit_elements.get("stream_id_entry") self._tr_flag_entry = self._digit_elements.get("tr_flag_entry") self._namespace_entry = self._non_empty_elements.get("namespace_entry") + self._extra_pids_entry = builder.get_object("extra_pids_entry") # Service elements self._name_entry = builder.get_object("name_entry") self._package_entry = builder.get_object("package_entry") @@ -244,6 +275,7 @@ class ServiceDetailsDialog: def init_enigma2_pids(self, flags): pids = list(filter(lambda x: x.startswith("c:"), flags)) if pids: + extra_pids = [] for pid in pids: if pid.startswith(Pids.VIDEO.value): self._video_pid_entry.set_text(str(int(pid[4:], 16))) @@ -256,15 +288,19 @@ class ServiceDetailsDialog: elif pid.startswith(Pids.AC3.value): self._ac3_pid_entry.set_text(str(int(pid[4:], 16))) elif pid.startswith(Pids.VIDEO_TYPE.value): - pass + extra_pids.append(pid) elif pid.startswith(Pids.AUDIO_CHANNEL.value): - pass + extra_pids.append(pid) elif pid.startswith(Pids.BIT_STREAM_DELAY.value): self._bitstream_entry.set_text(str(int(pid[4:], 16))) elif pid.startswith(Pids.PCM_DELAY.value): self._pcm_entry.set_text(str(int(pid[4:], 16))) elif pid.startswith(Pids.SUBTITLE.value): - pass + extra_pids.append(pid) + else: + extra_pids.append(pid) + + self._extra_pids_entry.set_text(",".join(extra_pids)) def init_enigma2_transponder_data(self, srv): """ Transponder data initialisation """ @@ -533,6 +569,9 @@ class ServiceDetailsDialog: pcm_pid = self._pcm_entry.get_text() if pcm_pid: flags.append("{}{:04x}".format(Pids.PCM_DELAY.value, int(pcm_pid))) + extra_pids = self._extra_pids_entry.get_text() + if extra_pids: + flags.append(extra_pids) # flags f_flags = Flag.KEEP.value if self._keep_check_button.get_active() else 0 f_flags = f_flags + Flag.HIDE.value if self._hide_check_button.get_active() else f_flags @@ -692,6 +731,9 @@ class ServiceDetailsDialog: def on_cas_entry_changed(self, entry): entry.set_name("GtkEntry" if self._CAID_PATTERN.fullmatch(entry.get_text()) else self._DIGIT_ENTRY_NAME) + def on_extra_pids_entry_changed(self, entry): + entry.set_name("GtkEntry" if self._PIDS_PATTERN.fullmatch(entry.get_text()) else self._DIGIT_ENTRY_NAME) + def get_value_from_combobox_id(self, box: Gtk.ComboBox, dc: dict): cb_id = box.get_active_id() return get_key_by_value(dc, cb_id) @@ -724,6 +766,8 @@ class ServiceDetailsDialog: return False if self._cas_entry.get_name() == self._DIGIT_ENTRY_NAME: return False + if self._extra_pids_entry.get_name() == self._DIGIT_ENTRY_NAME: + return False return True def update_reference(self, entry, event=None):