added eserviceuri (8193) stream type

This commit is contained in:
DYefremov
2020-06-09 18:38:18 +03:00
parent 2c4302f57d
commit b51c8a9aed
2 changed files with 11 additions and 9 deletions

View File

@@ -95,23 +95,24 @@ def get_bouquet(path, bq_name, bq_type):
bq_name = srvs.pop(0) bq_name = srvs.pop(0)
for srv in srvs: for num, srv in enumerate(srvs, start=1):
srv_data = srv.strip().split(":") srv_data = srv.strip().split(":")
if srv_data[1] == "64": if srv_data[1] == "64":
m_data, sep, desc = srv.partition("#DESCRIPTION") m_data, sep, desc = srv.partition("#DESCRIPTION")
services.append(BouquetService(desc.strip() if desc else "", BqServiceType.MARKER, srv, srv_data[2])) services.append(BouquetService(desc.strip() if desc else "", BqServiceType.MARKER, srv, num))
elif srv_data[1] == "832": elif srv_data[1] == "832":
m_data, sep, desc = srv.partition("#DESCRIPTION") m_data, sep, desc = srv.partition("#DESCRIPTION")
services.append(BouquetService(desc.strip() if desc else "", BqServiceType.SPACE, srv, srv_data[3])) services.append(BouquetService(desc.strip() if desc else "", BqServiceType.SPACE, srv, num))
elif "http" in srv: elif "http" in srv or srv_data[0] == "8193":
stream_data, sep, desc = srv.partition("#DESCRIPTION") stream_data, sep, desc = srv.partition("#DESCRIPTION")
services.append(BouquetService(desc.lstrip(":").strip() if desc else "", BqServiceType.IPTV, srv, 0)) desc = desc.lstrip(":").strip() if desc else srv_data[-1].strip()
services.append(BouquetService(desc, BqServiceType.IPTV, srv, num))
else: else:
fav_id = "{}:{}:{}:{}".format(srv_data[3], srv_data[4], srv_data[5], srv_data[6]) fav_id = "{}:{}:{}:{}".format(srv_data[3], srv_data[4], srv_data[5], srv_data[6])
name = None name = None
if len(srv_data) == 12: if len(srv_data) == 12:
name, sep, desc = str(srv_data[-1]).partition("\n#DESCRIPTION") name, sep, desc = str(srv_data[-1]).partition("\n#DESCRIPTION")
services.append(BouquetService(name, BqServiceType.DEFAULT, fav_id.upper(), 0)) services.append(BouquetService(name, BqServiceType.DEFAULT, fav_id.upper(), num))
return bq_name.lstrip("#NAME").strip(), services return bq_name.lstrip("#NAME").strip(), services

View File

@@ -1,7 +1,7 @@
""" Module for IPTV and streams support """ """ Module for IPTV and streams support """
import re import re
import urllib.request
from enum import Enum from enum import Enum
from urllib.parse import unquote
from app.settings import SettingsType from app.settings import SettingsType
from app.ui.uicommons import IPTV_ICON from app.ui.uicommons import IPTV_ICON
@@ -18,6 +18,7 @@ class StreamType(Enum):
NONE_TS = "4097" NONE_TS = "4097"
NONE_REC_1 = "5001" NONE_REC_1 = "5001"
NONE_REC_2 = "5002" NONE_REC_2 = "5002"
E_SERVICE_URI = "8193"
def parse_m3u(path, s_type): def parse_m3u(path, s_type):
@@ -64,7 +65,7 @@ def export_to_m3u(path, bouquet, s_type):
lines.append("#EXTINF:-1,{}\n".format(s.name)) lines.append("#EXTINF:-1,{}\n".format(s.name))
if current_grp: if current_grp:
lines.append(current_grp) lines.append(current_grp)
lines.append("{}\n".format(urllib.request.unquote(data.strip()))) lines.append("{}\n".format(unquote(data.strip())))
elif s_type is BqServiceType.MARKER: elif s_type is BqServiceType.MARKER:
current_grp = "#EXTGRP:{}\n".format(s.name) current_grp = "#EXTGRP:{}\n".format(s.name)
@@ -75,7 +76,7 @@ def export_to_m3u(path, bouquet, s_type):
def get_fav_id(url, service_name, s_type): def get_fav_id(url, service_name, s_type):
""" Returns fav id depending on the profile. """ """ Returns fav id depending on the profile. """
if s_type is SettingsType.ENIGMA_2: if s_type is SettingsType.ENIGMA_2:
url = urllib.request.quote(url) url = unquote(url)
stream_type = StreamType.NONE_TS.value stream_type = StreamType.NONE_TS.value
return ENIGMA2_FAV_ID_FORMAT.format(stream_type, 1, 0, 0, 0, 0, url, service_name, service_name, None) return ENIGMA2_FAV_ID_FORMAT.format(stream_type, 1, 0, 0, 0, 0, url, service_name, service_name, None)
elif s_type is SettingsType.NEUTRINO_MP: elif s_type is SettingsType.NEUTRINO_MP: