Add tvg-chno support using channel number from markdown lists (#1018)

* Add channel number to M3U line formatting

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

* 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

* Delete playlists/playlist_italy.m3u8

delete italy playlist for updating with channel number

* Italy playlist updated with channel number
master
Giacinto Lo Meo 2026-04-09 05:21:25 +02:00 committed by GitHub
parent 4462172b34
commit ea332da787
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 85 additions and 81 deletions

View File

@ -103,6 +103,9 @@ class Channel:
self.url = self.url[self.url.find("(")+1:self.url.rfind(")")]
self.logo = parts[4].strip()
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:
self.epg = parts[5].strip()
else:
@ -110,10 +113,11 @@ class Channel:
def to_m3u_line(self):
country = f' tvg-country="{self.country_code}"' if self.country_code else ""
chno = f' tvg-chno="{self.chno}"' if self.chno else ""
if self.epg is None:
return (f'#EXTINF:-1 tvg-name="{self.name}" tvg-logo="{self.logo}"{country} group-title="{self.group}",{self.name}\n{self.url}')
return (f'#EXTINF:-1 tvg-name="{self.name}" tvg-logo="{self.logo}"{chno}{country} group-title="{self.group}",{self.name}\n{self.url}')
else:
return (f'#EXTINF:-1 tvg-name="{self.name}" tvg-logo="{self.logo}" tvg-id="{self.epg}"{country} group-title="{self.group}",{self.name}\n{self.url}')
return (f'#EXTINF:-1 tvg-name="{self.name}" tvg-logo="{self.logo}" tvg-id="{self.epg}"{chno}{country} group-title="{self.group}",{self.name}\n{self.url}')
def main():

File diff suppressed because one or more lines are too long