Skip to content

Add M3U playlist / XMLTV export for external IPTV players#69

Open
selcukkirtas wants to merge 1 commit into
jvdillon:mainfrom
selcukkirtas:m3u-export
Open

Add M3U playlist / XMLTV export for external IPTV players#69
selcukkirtas wants to merge 1 commit into
jvdillon:mainfrom
selcukkirtas:m3u-export

Conversation

@selcukkirtas

Copy link
Copy Markdown

What

Exposes the live channels a neTV user can access as an Xtream-style playlist, so external IPTV players (TiviMate, IPTV Smarters, VLC, etc.) can use neTV as a source:

  • GET /get.php?username=U&password=P → M3U playlist (m3u_plus attributes: tvg-id, tvg-logo, group-title)
  • GET /xmltv.php?username=U&password=P → XMLTV guide generated from the local EPG database
  • GET /live/U/P/{stream_id}.ts → channel playback

Why

neTV's web UI is great on desktops and TVs with a browser, but many households also have devices where a native IPTV player app is the better (or only) option. This lets one neTV instance serve both, with the same user accounts and channel restrictions.

How

  • Two playback modes (admin-selectable in Settings → M3U Export):
    • redirect (default): 302 to the provider URL — zero server bandwidth.
    • proxy: bytes flow through neTV — hides the provider URL/credentials from clients and enforces per-user + per-source stream limits. HLS direct URLs always redirect (proxying would require rewriting segment URLs).
  • Auth integration: credentials in the URL are the normal neTV accounts. Per-user unavailable_groups filtering applies to both the playlist and playback; failed attempts feed the existing login rate limiter. PBKDF2 verification results are cached in memory (5 min TTL, invalidated on password change/user delete) so channel zapping stays fast on small ARM boards.
  • Off by default; enabled via a new Settings section that also displays the player URLs.

New logic lives in m3u_export.py with routes in main.py, following the existing ffmpeg_session.py module/route split.

Testing

  • 31 new tests in m3u_export_test.py (credential caching, playlist/XMLTV generation, group restrictions, stream limits, and route-level tests incl. redirect/proxy modes and rate limiting).
  • Full suite passes: 412 tests. ruff and basedpyright clean.

🤖 Generated with Claude Code

Exposes live channels as an Xtream-style playlist so external players
(TiviMate, IPTV Smarters, VLC) can use neTV as a source:

- GET /get.php?username=U&password=P   -> M3U playlist (m3u_plus attrs)
- GET /xmltv.php?username=U&password=P -> XMLTV guide from local EPG db
- GET /live/U/P/{stream_id}.ts         -> channel playback

Playback supports two admin-selectable modes: redirect (302 to the
provider, zero server bandwidth) and proxy (streams flow through the
server, hides provider URL and enforces per-user/per-source stream
limits). HLS direct URLs always redirect since proxying would require
rewriting segment URLs.

Integrates with existing auth: per-user channel restrictions apply to
both the playlist and playback, failed attempts feed the login rate
limiter, and PBKDF2 verification is cached in memory (5 min TTL,
invalidated on password change / user delete) to keep channel zapping
fast on small ARM boards.

Feature is off by default; enabled via a new Settings > M3U Export
section that also shows the player URLs.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant