Update make_playlist.py

Add tvg-chno support using channel number from markdown lists

- Extract channel number from md lists
- Add tvg-chno attribute to M3U output
- Skip invalid values (e.g. 0)

Improves channel ordering in IPTV clients like Jellyfin
pull/1018/head
Giacinto Lo Meo 2026-04-07 22:41:26 +02:00 committed by GitHub
parent 15a049edc2
commit 86d11c8187
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -93,7 +93,6 @@ COUNTRY_CODES = {
class Channel: class Channel:
def __init__(self, group, md_line, country_code=""): def __init__(self, group, md_line, country_code=""):
self.chno = self.number if self.number and self.number != "0" else None
self.group = group self.group = group
self.country_code = country_code self.country_code = country_code
md_line = md_line.strip() md_line = md_line.strip()
@ -104,6 +103,9 @@ class Channel:
self.url = self.url[self.url.find("(")+1:self.url.rfind(")")] self.url = self.url[self.url.find("(")+1:self.url.rfind(")")]
self.logo = parts[4].strip() self.logo = parts[4].strip()
self.logo = self.logo[self.logo.find('src="')+5:self.logo.rfind('"')] self.logo = self.logo[self.logo.find('src="')+5:self.logo.rfind('"')]
self.chno = self.number if self.number and self.number != "0" else None
if len(parts) > 6: if len(parts) > 6:
self.epg = parts[5].strip() self.epg = parts[5].strip()
else: else: