Merge pull request #2 from ibrahimalayah-Glooko/copilot/lg-tv-integration

Add daily Arabic playlist bundle and optional email delivery
pull/1084/head
ibrahimalayah-Glooko 2026-06-19 17:06:55 +02:00 committed by GitHub
commit 1c22a486a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 266 additions and 16 deletions

View File

@ -3,6 +3,8 @@ name: Update playlist
on:
push:
branches: [ master ]
schedule:
- cron: "0 0 * * *"
workflow_dispatch:
jobs:
@ -19,3 +21,59 @@ jobs:
git add .
git diff --staged --quiet || git commit --quiet -m "Update Playlist (GitHub Actions)"
git diff --quiet HEAD @{u} || git push -f origin HEAD
- name: Email Arabic playlist links
if: ${{ (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && secrets.SMTP_HOST != '' && secrets.SMTP_USERNAME != '' && secrets.SMTP_PASSWORD != '' && secrets.RECIPIENT_EMAIL != '' }}
env:
RECIPIENT_EMAIL: ${{ secrets.RECIPIENT_EMAIL }}
SMTP_FROM: ${{ secrets.SMTP_FROM }}
SMTP_HOST: ${{ secrets.SMTP_HOST }}
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }}
SMTP_PORT: ${{ secrets.SMTP_PORT }}
SMTP_USERNAME: ${{ secrets.SMTP_USERNAME }}
run: |
python3 - <<'PY'
import os
import smtplib
from email.message import EmailMessage
repository = os.environ["GITHUB_REPOSITORY"]
branch = os.environ.get("GITHUB_REF_NAME", "master")
raw_base = f"https://raw.githubusercontent.com/{repository}/{branch}/playlists"
links = [
("Arabic bundle", f"{raw_base}/playlist_arabic.m3u8"),
("Arabic news", f"{raw_base}/playlist_zz_news_ar.m3u8"),
("Arabic documentaries", f"{raw_base}/playlist_zz_documentaries_ar.m3u8"),
("Egypt", f"{raw_base}/playlist_egypt.m3u8"),
("Iraq", f"{raw_base}/playlist_iraq.m3u8"),
("Qatar", f"{raw_base}/playlist_qatar.m3u8"),
("Saudi Arabia", f"{raw_base}/playlist_saudi_arabia.m3u8"),
("United Arab Emirates", f"{raw_base}/playlist_united_arab_emirates.m3u8"),
]
message = EmailMessage()
message["Subject"] = "Daily Arabic IPTV playlists"
message["From"] = os.environ.get("SMTP_FROM") or os.environ["SMTP_USERNAME"]
message["To"] = os.environ["RECIPIENT_EMAIL"]
message.set_content(
"Latest curated Arabic playlists from this repository:\n\n"
+ "\n".join(f"- {name}: {url}" for name, url in links)
)
host = os.environ["SMTP_HOST"]
port = int(os.environ.get("SMTP_PORT") or "587")
username = os.environ["SMTP_USERNAME"]
password = os.environ["SMTP_PASSWORD"]
if port == 465:
smtp = smtplib.SMTP_SSL(host, port)
else:
smtp = smtplib.SMTP(host, port)
with smtp:
smtp.ehlo()
if port != 465:
smtp.starttls()
smtp.ehlo()
smtp.login(username, password)
smtp.send_message(message)
PY

View File

@ -1,15 +0,0 @@
{
"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
}
}

View File

@ -95,6 +95,22 @@ Or free on the Internet:
To use it point your IPTV player to https://raw.githubusercontent.com/Free-TV/IPTV/master/playlist.m3u8.
Arabic playlists
================
The repository also generates a dedicated Arabic bundle under `playlists/playlist_arabic.m3u8`, alongside the existing country and category playlists.
- Combined Arabic bundle: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_arabic.m3u8
- Arabic news: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_zz_news_ar.m3u8
- Arabic documentaries: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_zz_documentaries_ar.m3u8
- Egypt: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_egypt.m3u8
- Iraq: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_iraq.m3u8
- Qatar: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_qatar.m3u8
- Saudi Arabia: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_saudi_arabia.m3u8
- United Arab Emirates: https://raw.githubusercontent.com/ibrahimalayah-Glooko/IPTV/master/playlists/playlist_united_arab_emirates.m3u8
`.github/workflows/update_playlist.yml` refreshes these playlists every 24 hours. If you want the workflow to email the links daily, add the repository secrets `SMTP_HOST`, `SMTP_PORT`, `SMTP_USERNAME`, `SMTP_PASSWORD`, and `RECIPIENT_EMAIL` (optional: `SMTP_FROM`).
Philosophy
==========

View File

@ -90,6 +90,16 @@ COUNTRY_CODES = {
"venezuela": "VE",
}
ARABIC_PLAYLIST_KEYS = {
"egypt",
"iraq",
"qatar",
"saudi_arabia",
"united_arab_emirates",
"zz_documentaries_ar",
"zz_news_ar",
}
ARABIC_PRIORITY_COUNTRIES = {
"chad",
"egypt",
@ -148,15 +158,19 @@ def main():
epg_urls = [line.strip() for line in epg_file if line.strip()]
processed_epg_list = ", ".join(epg_urls)
head_playlist = f'#EXTM3U x-tvg-url="{processed_epg_list}"\n'
arabic_playlist_path = os.path.join(dir_playlists, "playlist_arabic.m3u8")
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, \
open(arabic_playlist_path, "w", encoding='utf-8') as arabic_playlist:
playlist.write(head_playlist)
arabic_playlist.write(head_playlist)
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)
country_path = os.path.join(dir_playlists, "playlist_" + filename[:-3] + ".m3u8")
country_key = filename[:-3]
include_in_arabic_playlist = country_key in ARABIC_PLAYLIST_KEYS
group = country_key.replace("_", " ").title()
country_code = COUNTRY_CODES.get(country_key, "")
print(f"Generating {group}")
@ -172,6 +186,8 @@ def main():
m3u_line = channel.to_m3u_line()
print(m3u_line, file=playlist)
print(m3u_line, file=playlist_country)
if include_in_arabic_playlist:
print(m3u_line, file=arabic_playlist)
if __name__ == "__main__":
main()

File diff suppressed because one or more lines are too long