Skip to content

Commit f4aa51e

Browse files
authored
Update main.py
1 parent 831b10c commit f4aa51e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

main.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ def getChannelItems():
77
Get the channel items from the source URLs
88
"""
99
channels = {}
10+
current_channel = None
1011

1112
for url in Config.source_urls:
1213
# Check if the URL ends with ".m3u"
@@ -23,7 +24,6 @@ def getChannelItems():
2324
if response.status_code == 200:
2425
# Extract channel items from the response text
2526
lines = response.text.split("\n")
26-
current_channel = ""
2727
pattern = r"^(.*?),(?!#genre#)(.*?)$"
2828

2929
for line in lines:
@@ -54,7 +54,7 @@ def updateChannelUrlsM3U(channels, template_channels):
5454
f.write("#EXTM3U\n")
5555
for channel in template_channels:
5656
if channel in channels:
57-
for key, urls in sorted(channels[channel].items()):
57+
for key, urls in channels[channel].items():
5858
for url in urls:
5959
if url is not None:
6060
f.write(f"#EXTINF:-1 tvg-id=\"\" tvg-name=\"{key}\" tvg-logo=\"https://gitee.com/yuanzl77/TVBox-logo/raw/main/png/{key}.png\" group-title=\"{channel}\",{key}\n")
@@ -84,6 +84,6 @@ def filter_source_urls(template_file):
8484
return channels, template_channels
8585

8686
if __name__ == "__main__":
87-
template_file = "demo.txt"
87+
template_file = "demo.txt" # Replace "demo.txt" with your actual template file
8888
channels, template_channels = filter_source_urls(template_file)
8989
updateChannelUrlsM3U(channels, template_channels)

0 commit comments

Comments
 (0)