mirror of
https://github.com/DYefremov/DemonEditor.git
synced 2025-12-24 01:19:40 +01:00
skip importing groups from m3u for Neutrino
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
#
|
#
|
||||||
# The MIT License (MIT)
|
# The MIT License (MIT)
|
||||||
#
|
#
|
||||||
# Copyright (c) 2018-2021 Dmitriy Yefremov
|
# Copyright (c) 2018-2022 Dmitriy Yefremov
|
||||||
#
|
#
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
# of this software and associated documentation files (the "Software"), to deal
|
||||||
@@ -49,6 +49,11 @@ class StreamType(Enum):
|
|||||||
NONE_REC_2 = "5002"
|
NONE_REC_2 = "5002"
|
||||||
E_SERVICE_URI = "8193"
|
E_SERVICE_URI = "8193"
|
||||||
E_SERVICE_HLS = "8739"
|
E_SERVICE_HLS = "8739"
|
||||||
|
UNKNOWN = "0"
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def _missing_(cls, value):
|
||||||
|
return cls.UNKNOWN
|
||||||
|
|
||||||
|
|
||||||
def parse_m3u(path, s_type, detect_encoding=True, params=None):
|
def parse_m3u(path, s_type, detect_encoding=True, params=None):
|
||||||
@@ -76,6 +81,7 @@ def parse_m3u(path, s_type, detect_encoding=True, params=None):
|
|||||||
p_id = "1_0_1_0_0_0_0_0_0_0.png"
|
p_id = "1_0_1_0_0_0_0_0_0_0.png"
|
||||||
st = BqServiceType.IPTV.name
|
st = BqServiceType.IPTV.name
|
||||||
params = params or [0, 0, 0, 0]
|
params = params or [0, 0, 0, 0]
|
||||||
|
m_name = BqServiceType.MARKER.name
|
||||||
|
|
||||||
for line in str(data, encoding=encoding, errors="ignore").splitlines():
|
for line in str(data, encoding=encoding, errors="ignore").splitlines():
|
||||||
if line.startswith("#EXTINF"):
|
if line.startswith("#EXTINF"):
|
||||||
@@ -88,20 +94,21 @@ def parse_m3u(path, s_type, detect_encoding=True, params=None):
|
|||||||
d = {data[i].lower().strip(" ="): data[i + 1] for i in range(0, len(data) - 1, 2)}
|
d = {data[i].lower().strip(" ="): data[i + 1] for i in range(0, len(data) - 1, 2)}
|
||||||
picon = d.get("tvg-logo", None)
|
picon = d.get("tvg-logo", None)
|
||||||
|
|
||||||
grp_name = d.get("group-title", None)
|
if s_type is SettingsType.ENIGMA_2:
|
||||||
if grp_name not in groups:
|
grp_name = d.get("group-title", None)
|
||||||
groups.add(grp_name)
|
if grp_name not in groups:
|
||||||
fav_id = MARKER_FORMAT.format(marker_counter, grp_name, grp_name)
|
groups.add(grp_name)
|
||||||
marker_counter += 1
|
fav_id = MARKER_FORMAT.format(marker_counter, grp_name, grp_name)
|
||||||
mr = Service(None, None, None, grp_name, *aggr[0:3], BqServiceType.MARKER.name, *aggr, fav_id, None)
|
marker_counter += 1
|
||||||
services.append(mr)
|
mr = Service(None, None, None, grp_name, *aggr[0:3], m_name, *aggr, fav_id, None)
|
||||||
|
services.append(mr)
|
||||||
elif line.startswith("#EXTGRP") and s_type is SettingsType.ENIGMA_2:
|
elif line.startswith("#EXTGRP") and s_type is SettingsType.ENIGMA_2:
|
||||||
grp_name = line.strip("#EXTGRP:").strip()
|
grp_name = line.strip("#EXTGRP:").strip()
|
||||||
if grp_name not in groups:
|
if grp_name not in groups:
|
||||||
groups.add(grp_name)
|
groups.add(grp_name)
|
||||||
fav_id = MARKER_FORMAT.format(marker_counter, grp_name, grp_name)
|
fav_id = MARKER_FORMAT.format(marker_counter, grp_name, grp_name)
|
||||||
marker_counter += 1
|
marker_counter += 1
|
||||||
mr = Service(None, None, None, grp_name, *aggr[0:3], BqServiceType.MARKER.name, *aggr, fav_id, None)
|
mr = Service(None, None, None, grp_name, *aggr[0:3], m_name, *aggr, fav_id, None)
|
||||||
services.append(mr)
|
services.append(mr)
|
||||||
elif not line.startswith("#"):
|
elif not line.startswith("#"):
|
||||||
url = line.strip()
|
url = line.strip()
|
||||||
|
|||||||
Reference in New Issue
Block a user