mirror of https://github.com/Free-TV/IPTV
Merge pull request #1 from ibrahimalayah-Glooko/copilot/latest-m3u-arabic
Prioritize Arabic entries in the generated M3Upull/1084/head
commit
5d098eae68
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"files": ["playlist1.m3u", "playlist2.m3u"],
|
||||||
|
"rules": {
|
||||||
|
"no-empty-lines": true,
|
||||||
|
"require-header": true,
|
||||||
|
"attribute-quotes": true,
|
||||||
|
"require-info": true,
|
||||||
|
"no-trailing-spaces": true,
|
||||||
|
"no-whitespace-before-title": true,
|
||||||
|
"no-multi-spaces": false,
|
||||||
|
"no-extra-comma": true,
|
||||||
|
"space-before-paren": false,
|
||||||
|
"no-dash": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -90,6 +90,16 @@ COUNTRY_CODES = {
|
||||||
"venezuela": "VE",
|
"venezuela": "VE",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ARABIC_PRIORITY_COUNTRIES = {
|
||||||
|
"chad",
|
||||||
|
"egypt",
|
||||||
|
"iraq",
|
||||||
|
"qatar",
|
||||||
|
"saudi_arabia",
|
||||||
|
"somalia",
|
||||||
|
"united_arab_emirates",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class Channel:
|
class Channel:
|
||||||
def __init__(self, group, md_line, country_code=""):
|
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}')
|
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():
|
def main():
|
||||||
base_dir = os.path.dirname(os.path.abspath(__file__))
|
base_dir = os.path.dirname(os.path.abspath(__file__))
|
||||||
lists_dir = os.path.join(base_dir, "lists")
|
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:
|
with open(os.path.join(base_dir, "playlist.m3u8"), "w", encoding='utf-8') as playlist:
|
||||||
playlist.write(head_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"):
|
if filename == "README.md" or not filename.endswith(".md"):
|
||||||
continue
|
continue
|
||||||
markup_path = os.path.join(lists_dir, filename)
|
markup_path = os.path.join(lists_dir, filename)
|
||||||
|
|
|
||||||
388
playlist.m3u8
388
playlist.m3u8
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue