From b97e2083ce3b82ba14fba1dae18d6d5fad38e0fa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 19 Jun 2026 15:00:31 +0000 Subject: [PATCH] Generate Arabic playlist bundle --- .github/workflows/update_playlist.yml | 58 +++++++++++++++++++++++++++ README.md | 16 ++++++++ make_playlist.py | 18 ++++++++- 3 files changed, 91 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update_playlist.yml b/.github/workflows/update_playlist.yml index 64ff68b..8a5b06c 100644 --- a/.github/workflows/update_playlist.yml +++ b/.github/workflows/update_playlist.yml @@ -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 diff --git a/README.md b/README.md index b78970c..29119b4 100644 --- a/README.md +++ b/README.md @@ -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 ========== diff --git a/make_playlist.py b/make_playlist.py index 143655c..bfec009 100755 --- a/make_playlist.py +++ b/make_playlist.py @@ -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", +} + class Channel: def __init__(self, group, md_line, country_code=""): @@ -132,15 +142,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)): 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}") @@ -156,6 +170,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()