Update scripts/generate_playlist.py
Some checks failed
📺 Generate M3U Playlist / build (push) Has been cancelled
Some checks failed
📺 Generate M3U Playlist / build (push) Has been cancelled
This commit is contained in:
parent
3b1adf521b
commit
f5533ea1f6
1 changed files with 19 additions and 3 deletions
|
@ -114,7 +114,7 @@ def detect_country_from_channel(channel_name, epg_id="", logo_url=""):
|
||||||
"🇹🇭 Thailand": ["ch3", "ch7", "thai pbs", "thailand", "thai", " th ", ".th"],
|
"🇹🇭 Thailand": ["ch3", "ch7", "thai pbs", "thailand", "thai", " th ", ".th"],
|
||||||
"🇻🇳 Vietnam": ["vtv", "htv", "vietnam", "vietnamese", " vn ", ".vn"],
|
"🇻🇳 Vietnam": ["vtv", "htv", "vietnam", "vietnamese", " vn ", ".vn"],
|
||||||
"🇮🇩 Indonesia": ["tvri", "sctv", "rcti", "indonesia", "indonesian", " id ", ".id"],
|
"🇮🇩 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"],
|
"🇸🇬 Singapore": ["channel 5", "channel 8", "singapore", " sg ", ".sg"],
|
||||||
"🇵🇭 Philippines": ["abs-cbn", "gma", "philippines", "filipino", " ph ", ".ph"],
|
"🇵🇭 Philippines": ["abs-cbn", "gma", "philippines", "filipino", " ph ", ".ph"],
|
||||||
"🇮🇳 India": ["star plus", "zee tv", "colors", "sony tv", "india", "indian", "hindi", " in ", ".in"],
|
"🇮🇳 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"],
|
"🇳🇿 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"],
|
"🇸🇦 Arabic": ["al jazeera", "mbc", "lbc", "dubai tv", "arabic", "arab", "qatar", "dubai", "saudi"],
|
||||||
"🇮🇱 Israel": ["kan", "keshet 12", "israel", "israeli", "hebrew", " il ", ".il"],
|
"🇮🇱 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"],
|
"🇮🇷 Iran": ["irib", "press tv", "iran", "iranian", "persian", " ir ", ".ir"],
|
||||||
"🇪🇬 Egypt": ["nile tv", "cbc egypt", "egypt", "egyptian", " eg ", ".eg"],
|
"🇪🇬 Egypt": ["nile tv", "cbc egypt", "egypt", "egyptian", " eg ", ".eg"],
|
||||||
"🇿🇦 South Africa": ["sabc", "etv", "mnet", "south africa", " za ", ".za"],
|
"🇿🇦 South Africa": ["sabc", "etv", "mnet", "south africa", " za ", ".za"],
|
||||||
"🇳🇬 Nigeria": ["nta", "channels tv", "nigeria", "nigerian", " ng ", ".ng"]
|
"🇳🇬 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 country, keywords in patterns.items():
|
||||||
for keyword in keywords:
|
for keyword in keywords:
|
||||||
if keyword in all_text:
|
if keyword in all_text:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue