From 3e6a7f8a429e9f993ed98562a9c19eba9a76a522 Mon Sep 17 00:00:00 2001 From: DYefremov Date: Sun, 27 Jan 2019 23:20:07 +0300 Subject: [PATCH] changed parsing for iptv services --- app/eparser/enigma/bouquets.py | 3 ++- app/ui/iptv.py | 9 +++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/eparser/enigma/bouquets.py b/app/eparser/enigma/bouquets.py index 5138cf03..d675044b 100644 --- a/app/eparser/enigma/bouquets.py +++ b/app/eparser/enigma/bouquets.py @@ -72,7 +72,8 @@ def get_bouquet(path, name, bq_type): if ch_data[1] == "64": services.append(BouquetService(ch_data[-1].split("\n")[0], BqServiceType.MARKER, ch, ch_data[2])) elif "http" in ch: - services.append(BouquetService(ch_data[-1].split("\n")[0], BqServiceType.IPTV, ch, 0)) + stream_data = ch.split("#DESCRIPTION", 1) + services.append(BouquetService(stream_data[-1].strip(":").strip(), BqServiceType.IPTV, ch, 0)) else: fav_id = "{}:{}:{}:{}".format(ch_data[3], ch_data[4], ch_data[5], ch_data[6]) name = None diff --git a/app/ui/iptv.py b/app/ui/iptv.py index b0d78a1c..f429626d 100644 --- a/app/ui/iptv.py +++ b/app/ui/iptv.py @@ -1,4 +1,5 @@ import re +import urllib from urllib.error import HTTPError from urllib.parse import urlparse @@ -110,10 +111,10 @@ class IptvDialog: self.init_enigma2_data(fav_id) if self._profile is Profile.ENIGMA_2 else self.init_neutrino_data(fav_id) def init_enigma2_data(self, fav_id): - data, sep, desc = fav_id.partition("#DESCRIPTION:") + data, sep, desc = fav_id.partition("#DESCRIPTION") self._description_entry.set_text(desc.strip()) data = data.split(":") - if len(data) < 12: + if len(data) < 11: 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]) @@ -121,7 +122,7 @@ class IptvDialog: self._tr_id_entry.set_text(str(int(data[4], 16))) self._net_id_entry.set_text(str(int(data[5], 16))) self._namespace_entry.set_text(str(int(data[6], 16))) - self._url_entry.set_text(data[10].replace("%3a", ":")) + self._url_entry.set_text(urllib.request.unquote(data[10].strip())) self._update_reference_entry() def init_neutrino_data(self, fav_id): @@ -163,7 +164,7 @@ class IptvDialog: int(self._tr_id_entry.get_text()), int(self._net_id_entry.get_text()), int(self._namespace_entry.get_text()), - self._url_entry.get_text().replace(":", "%3a"), + urllib.request.quote(self._url_entry.get_text()), name, name) self.update_bouquet_data(name, fav_id)