def save_neutrino_data(self): if self._action is Action.EDIT: id_data = self._current_srv[7].split("::") else: id_data = ["", "", "0", None, None, None, None, "", "", "1"] 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)) self._dialog.destroy()
def parse_webtv(path, name, bq_type): bouquets = Bouquets(name=name, type=bq_type, bouquets=[]) if not os.path.exists(path): return bouquets dom = parse(path) services = [] for elem in dom.getElementsByTagName("webtv"): if elem.hasAttributes(): title = elem.attributes["title"].value url = elem.attributes["url"].value description = elem.attributes.get("description") description = description.value if description else description urlkey = elem.attributes.get("urlkey", None) urlkey = urlkey.value if urlkey else urlkey account = elem.attributes.get("account", None) account = account.value if account else account usrname = elem.attributes.get("usrname", None) usrname = usrname.value if usrname else usrname psw = elem.attributes.get("psw", None) psw = psw.value if psw else psw s_type = elem.attributes.get("type", None) s_type = s_type.value if s_type else s_type iconsrc = elem.attributes.get("iconsrc", None) iconsrc = iconsrc.value if iconsrc else iconsrc iconsrc_b = elem.attributes.get("iconsrc_b", None) iconsrc_b = iconsrc_b.value if iconsrc_b else iconsrc_b group = elem.attributes.get("group", None) group = group.value if group else group fav_id = NEUTRINO_FAV_ID_FORMAT.format(url, description, urlkey, account, usrname, psw, s_type, iconsrc, iconsrc_b, group) services.append( BouquetService(name=title, type=BqServiceType.IPTV, data=fav_id, num=0)) bouquet = Bouquet(name="default", type=bq_type, services=services, locked=None, hidden=None) bouquets[2].append(bouquet) return bouquets
def parse_webtv(path, name, bq_type): bouquets = Bouquets(name=name, type=bq_type, bouquets=[]) if not os.path.exists(path): return bouquets dom = XmlHandler.parse(path) services = [] for elem in dom.getElementsByTagName("webtv"): if elem.hasAttributes(): web_attrs = get_xml_attributes(elem) title = web_attrs.get("title", "") url = web_attrs.get("url", "") description = web_attrs.get("description", "") urlkey = web_attrs.get("urlkey", None) account = web_attrs.get("account", None) usrname = web_attrs.get("usrname", None) psw = web_attrs.get("psw", None) s_type = web_attrs.get("type", None) iconsrc = web_attrs.get("iconsrc", None) iconsrc_b = web_attrs.get("iconsrc_b", None) group = web_attrs.get("group", None) fav_id = NEUTRINO_FAV_ID_FORMAT.format(url, description, urlkey, account, usrname, psw, s_type, iconsrc, iconsrc_b, group) services.append( BouquetService(name=title, type=BqServiceType.IPTV, data=fav_id, num=0)) bouquet = Bouquet(name="default", type=bq_type, services=services, locked=None, hidden=None, file=None) bouquets[2].append(bouquet) return bouquets