Update scripts/generate_playlist.py
Some checks failed
📺 Generate M3U Playlist / build (push) Has been cancelled

This commit is contained in:
stoney420 2025-06-27 19:42:25 +02:00
parent 3b1adf521b
commit f5533ea1f6

View file

@ -114,7 +114,7 @@ def detect_country_from_channel(channel_name, epg_id="", logo_url=""):
"🇹🇭 Thailand": ["ch3", "ch7", "thai pbs", "thailand", "thai", " th ", ".th"],
"🇻🇳 Vietnam": ["vtv", "htv", "vietnam", "vietnamese", " vn ", ".vn"],
"🇮🇩 Indonesia": ["tvri", "sctv", "rcti", "indonesia", "indonesian", " id ", ".id"],
"🇲🇾 Malaysia": ["tv1", "tv3", "astro", "malaysia", "malaysian", " my ", ".my"],
"🇲🇾 Malaysia": ["tv1", "tv3", "astro", "malaysia", "malaysian", " my ", ".my", "my:"],
"🇸🇬 Singapore": ["channel 5", "channel 8", "singapore", " sg ", ".sg"],
"🇵🇭 Philippines": ["abs-cbn", "gma", "philippines", "filipino", " ph ", ".ph"],
"🇮🇳 India": ["star plus", "zee tv", "colors", "sony tv", "india", "indian", "hindi", " in ", ".in"],
@ -127,14 +127,30 @@ def detect_country_from_channel(channel_name, epg_id="", logo_url=""):
"🇳🇿 New Zealand": ["tvnz", "tvnz 1", "tvnz 2", "three nz", "tvnz duke", "new zealand", "kiwi", " nz ", ".nz"],
"🇸🇦 Arabic": ["al jazeera", "mbc", "lbc", "dubai tv", "arabic", "arab", "qatar", "dubai", "saudi"],
"🇮🇱 Israel": ["kan", "keshet 12", "israel", "israeli", "hebrew", " il ", ".il"],
"🇹🇷 Turkey": ["trt", "atv", "kanal d", "turkey", "turkish", " tr ", ".tr"],
"🇹🇷 Turkey": ["trt", "atv", "kanal d", "turkey", "turkish", " tr ", ".tr", "tr |"],
"🇮🇷 Iran": ["irib", "press tv", "iran", "iranian", "persian", " ir ", ".ir"],
"🇪🇬 Egypt": ["nile tv", "cbc egypt", "egypt", "egyptian", " eg ", ".eg"],
"🇿🇦 South Africa": ["sabc", "etv", "mnet", "south africa", " za ", ".za"],
"🇳🇬 Nigeria": ["nta", "channels tv", "nigeria", "nigerian", " ng ", ".ng"]
}
# Check patterns
# Check patterns - order matters, more specific first
# First check for country prefixes (more specific)
country_prefixes = {
"🇺🇦 Ukraine": ["ua |", "ukraine"],
"🇵🇱 Poland": ["pl |", "poland"],
"🇹🇷 Turkey": ["tr |", "turkey"],
"🇲🇾 Malaysia": ["my:", "malaysia"],
"🇬🇧 United Kingdom": ["uk:", "united kingdom"]
}
for country, prefixes in country_prefixes.items():
for prefix in prefixes:
if prefix in all_text:
log_message(f"Detected {country} for: {channel_name} (matched prefix: '{prefix}')", "INFO")
return country
# Then check general patterns
for country, keywords in patterns.items():
for keyword in keywords:
if keyword in all_text: