iptv format fix

This commit is contained in:
Dmitriy Yefremov
2017-12-08 23:48:20 +03:00
parent 1125e010cf
commit f1349231b2
2 changed files with 6 additions and 2 deletions

View File

@@ -35,7 +35,10 @@ def write_bouquet(path, name, bq_type, channels):
for ch in channels:
if not ch: # if was duplicate
continue
bouquet.append("#SERVICE {}\n".format(ch.fav_id if ch.service_type == "IPTV" else to_bouquet_id(ch)))
if ch.service_type == "IPTV":
bouquet.append(ch.fav_id)
else:
bouquet.append("#SERVICE {}\n".format(to_bouquet_id(ch)))
with open(path + "userbouquet.{}.{}".format(name, bq_type), "w") as file:
file.writelines(bouquet)

View File

@@ -13,7 +13,8 @@ def parse_m3u(path):
count += 1
elif count == 1:
count = 0
fav_id = "#SERVICE 4097:0:1:2:0:0:0:0:0:0:{}#DESCRIPTION:{}".format(line, name)
fav_id = "#SERVICE 1:0:1:0:0:0:0:0:0:0:{}:{}\n#DESCRIPTION: {}\n".format(
line.strip().replace(":", "%3a"), name, name)
channels.append(Channel(*aggr[0:3], name, *aggr[0:3], "IPTV", *aggr, fav_id, None))
return channels