mirror of https://github.com/Free-TV/IPTV
Prioritize Arabic groups in playlist generation
parent
f1f3666ec9
commit
795acf0e58
|
|
@ -90,6 +90,16 @@ COUNTRY_CODES = {
|
|||
"venezuela": "VE",
|
||||
}
|
||||
|
||||
ARABIC_PRIORITY_COUNTRIES = {
|
||||
"chad",
|
||||
"egypt",
|
||||
"iraq",
|
||||
"qatar",
|
||||
"saudi_arabia",
|
||||
"somalia",
|
||||
"united_arab_emirates",
|
||||
}
|
||||
|
||||
|
||||
class Channel:
|
||||
def __init__(self, group, md_line, country_code=""):
|
||||
|
|
@ -120,6 +130,12 @@ class Channel:
|
|||
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 playlist_sort_key(filename):
|
||||
country_key = filename[:-3]
|
||||
arabic_priority = country_key.endswith("_ar") or country_key in ARABIC_PRIORITY_COUNTRIES
|
||||
return (0 if arabic_priority else 1, filename)
|
||||
|
||||
|
||||
def main():
|
||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||
lists_dir = os.path.join(base_dir, "lists")
|
||||
|
|
@ -135,7 +151,7 @@ def main():
|
|||
|
||||
with open(os.path.join(base_dir, "playlist.m3u8"), "w", encoding='utf-8') as playlist:
|
||||
playlist.write(head_playlist)
|
||||
for filename in sorted(os.listdir(lists_dir)):
|
||||
for filename in sorted(os.listdir(lists_dir), key=playlist_sort_key):
|
||||
if filename == "README.md" or not filename.endswith(".md"):
|
||||
continue
|
||||
markup_path = os.path.join(lists_dir, filename)
|
||||
|
|
|
|||
Loading…
Reference in New Issue