MCPcopy Index your code
hub / github.com/alex-ahl/iptv-handler

github.com/alex-ahl/iptv-handler @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
340 symbols 616 edges 57 files 9 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Overview

Exclude unwanted channels based on group and generate a new M3U file with proxied streams and attributes. Updates the playlist on specified hourly frequency. Streams get proxied through a webserver running on the app. Support for XtreamCodes.

Setup

General

Get the generated .m3u file at /m3u

Settable environment variables

Variable Default Required Type Description
DATABASE_URL - Yes string Connection string to DB
M3U - Yes string URL to the M3U playlist (.m3u)
INIT_APP true No boolean Initialize app with M3U playlist from environment variable.
HOURLY_UPDATE_FREQUENCY 12 No number Frequency of provider playlist update in hours
GROUP_EXCLUDES - No string A comma separated list of groups to exclude from the final playlist. Case-insensitive.
PROXY_DOMAIN - Yes string Domain on which the app is running - to proxy m3u requests. (Example: localhost:3000)
ENV Development No string Set environment Development or Production.
PORT 3001 No number Port to run on (Default 3001)
RUST_LOG info Yes string Log level (warn,server=warn,iptv=info,api=warn rest-client=warn)
XTREAM_ENABLED false No boolean Enable Xtream
XTREAM_BASE_DOMAIN - No string Xtream provider base domain
XTREAM_USERNAME - No string Xtream provider username
XTREAM_PASSWORD - No string Xtream provider username
XTREAM_PROXIED_USERNAME - No string Proxied Xtream username
XTREAM_PROXIED_PASSWORD - No string Proxied Xtream password

Development

Set required environment variables in and .env file and then run docker-compose up.

This will fire up a MariaDB container instance and create a new DB. Which in turn will create tables and basic data using sql files in the server -> db -> migrations folder.

Production

To build and run a production docker image.

In src/server folder: docker build -t image:tag .

Create an external docker network with the name db and run your mariadb/mysql database there.

Example of production docker-compose.yml

version: '3.7'

services:
  iptvhandler:
    image: iptv-handler
    tty: true # color terminal output
    ports:
      - "3001:3001"
    restart: always
    environment:
      DATABASE_URL: mysql://username:password@db:3306/iptvhandler
      M3U: http://iptvprovider.tv:1234/get.php?username=username&password=password&type=m3u_plus&output=ts
      RUST_LOG: warn,server=info,iptv=debug
      HOURLY_UPDATE_FREQUENCY: 4
      GROUP_EXCLUDES: Music,Country,Cou
      PROXY_DOMAIN: myproxydomain.lan
      ENV: production
      XTREAM_ENABLE: "true"
      XTREAM_BASE_DOMAIN: iptvprovider.tv
      XTREAM_USERNAME: username
      XTREAM_PASSWORD: password
      XTREAM_PROXIED_USERNAME: my_new_username
      XTREAM_PROXIED_PASSWORD: my_new_password
    networks:
      - db
networks:
  db:
    external: true

DB

SQLX requirements for static type checking:

  • Needs to be named DATABASE_URL
  • Unfortunately have to have a common connection string for both docker container and host. Since IDE is running from host it needs access to db...
  • DATABASE_URL needs to be in .env file to work. Env variable in docker-compose does not work.
  • Add 127.0.0.1 host.docker.internal to your hosts file if docker hasn't done that for you

Example: DATABASE_URL="mysql://db:db@host.docker.internal:3306/iptvhandler"

Extension points exported contracts — how you extend this code

CRUD (Interface)
(no doc) [9 implementers]
src/db/src/lib.rs
HasId (Interface)
(no doc) [5 implementers]
src/api/src/services/mod.rs

Core symbols most depended-on inside this repo

get
called by 15
src/rest-client/src/lib.rs
insert
called by 12
src/db/src/models/m3u.rs
initialize_db
called by 10
src/db/src/services/group.rs
with_xtream_handler
called by 8
src/api/src/filters.rs
parse_url
called by 6
src/api/src/utils/url.rs
with_db
called by 5
src/api/src/filters.rs
compose_base_response
called by 5
src/api/src/utils/response.rs
compose_json_response
called by 5
src/api/src/utils/response.rs

Shape

Method 140
Function 117
Class 75
Enum 6
Interface 2

Languages

Rust100%

Modules by API surface

src/api/src/services/xtream.rs24 symbols
src/api/src/models/xtream.rs21 symbols
src/server/src/environment.rs17 symbols
src/iptv/src/m3u/parser.rs17 symbols
src/db/src/services/provider.rs13 symbols
src/api/src/utils/url.rs12 symbols
src/iptv/src/m3u/builder.rs11 symbols
src/db/src/models/group.rs11 symbols
src/api/src/filters.rs11 symbols
src/db/src/models/extinf.rs10 symbols
src/server/src/app.rs9 symbols
src/db/src/models/xtream_metadata.rs9 symbols

Datastores touched

(mysql)Database · 1 repos
iptvhandlerDatabase · 1 repos

For agents

$ claude mcp add iptv-handler \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact