# iptv-downloader A lightweight HTTP server for browsing and downloading content from an Xtream Codes IPTV provider. Written in C, zero runtime dependencies beyond libcurl and pthreads. ## Features - Browse series and movies by category - Full-text search across the entire catalogue - Sequential download queue with progress tracking, speed and ETA - Resume interrupted downloads; skip already-downloaded files - Discord webhook notifications on completion or failure - Jellyfin library refresh triggered after each successful download - Notification history with dismiss support - Runtime configuration — no recompile needed to change provider or paths ## Requirements - GCC, make - libcurl (development headers) - Linux (uses `SO_BINDTODEVICE` for VPN binding) ## Build ```sh make make test # optional — runs unit tests ``` ## Install ```sh sudo make install # installs binary to /usr/local/bin/iptv-dl # installs static files to /usr/local/share/iptv-dl/{css,js,html}/ ``` ## Configuration Create a config file at one of the following locations (first found wins): 1. Path passed via `--config PATH` 2. `$IPTV_DL_CONFIG` environment variable 3. `~/.iptv-downloader/config.json` 4. `/etc/iptv-downloader/config.json` 5. Built-in defaults (runs without any config file) Example config: ```json { "port": 8787, "bind_iface": "wg0-mullvad", "iptv_api": "http://your.provider/player_api.php", "iptv_user": "username", "iptv_pass": "password", "stream_base": "http://your.provider:80", "dl_dir_tv": "/mnt/media/TV", "dl_dir_mov": "/mnt/media/Movies", "discord_webhook": "", "jellyfin_url": "", "jellyfin_token": "", "template_dir": "/usr/local/share/iptv-dl", "data_dir": "/var/lib/iptv-dl", "max_recv_speed": 20971520 } ``` Print the active config: ```sh iptv-dl --dump-config ``` ## Source layout ``` config/ Runtime configuration (load/save/defaults) util/ String buffer, JSON parser, URL/HTML/JS escaping http/ HTTP request parsing, response helpers, route handlers notifs/ Notification ring buffer with persistence queue/ Download queue, worker thread, history, Xtream Codes API client integrations/ Discord webhook, Jellyfin library refresh static/css/ Stylesheet static/js/ Shared JS (BASE, filter, dlMov), downloads page, series selector static/html/ Page header and footer templates tests/ Unit tests main.c Server entry point (~80 lines) ``` ## Usage ```sh iptv-dl [--config PATH] [--dump-config] ``` The web UI is served at `http://localhost:8787/`. If running behind a reverse proxy at a sub-path (e.g. `/iptv/`), all asset and navigation links are relative and work correctly. ## License MIT