# dhasap/dhanytv architecture

> Architecture diagram of the GitHub repository dhasap/dhanytv, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dhasap/dhanytv
- Repository: https://github.com/dhasap/dhanytv

## Overview

dhanytv provides IPTV M3U playlists and XMLTV programme data, plus a browser player. Its user-facing flow is to load a playlist, parse and browse channels, look up EPG entries, then play a stream, optionally through a proxy. The README also describes daily playlist updates and Televizo/OTT variants. The source index identifies the update scripts as substantial, but their orchestration and several internal handoffs were not shown; those links are omitted rather than inferred.

Main entry points: [`update-script/update_playlist.sh`](https://github.com/dhasap/dhanytv/blob/main/update-script/update_playlist.sh) (Playlist update), [`web/src/main.js`](https://github.com/dhasap/dhanytv/blob/main/web/src/main.js) (Web app), [`epg.xml`](https://github.com/dhasap/dhanytv/blob/main/epg.xml) (XMLTV guide), [`dhanytv.m3u`](https://github.com/dhasap/dhanytv/blob/main/dhanytv.m3u) (M3U playlists)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_playlist["Playlist curation"]
  node_playlist_pipeline["Playlist update<br/>[update_playlist.sh]"]
  node_source_merge["Source merging<br/>[merge_source.py]"]
  node_extra_merge["Extra channels<br/>[merge_extra.py]"]
  node_international_merge["International channels"]
  node_astatv_merge["Astatv merge<br/>[merge_astatv.py]"]
  node_cleanup["Playlist cleanup"]
  node_repair["Playlist repair<br/>[repair_playlist.py]"]
  node_clearkey_fix["ClearKey fixes<br/>[fix_clearkeys.py]"]
  node_tag_fix["Tag fixes<br/>[fix_tags.py]"]
  node_group_normalize["Group normalization"]
  node_dash_tag["DASH tagging<br/>[tag_dash.py]"]
  node_protected_apply["Protected channels<br/>[apply_protected.py]"]
  node_channel_sort["Popularity sorting<br/>[sort_channels.py]"]
  node_televizo["Televizo variants<br/>[make_televizo.py]"]
  node_playlist_outputs["M3U playlists<br/>[dhanytv.m3u]"]
end

subgraph group_guide["EPG guide"]
  node_epg_generation["EPG generation<br/>[generate_epg.py]"]
  node_epg_append["EPG append<br/>[append_epg.py]"]
  node_epg_output["XMLTV guide<br/>[epg.xml]"]
end

subgraph group_web["Web playback"]
  node_web_app["Web app<br/>[main.js]"]
  node_m3u_parser["M3U parser<br/>[m3u.js]"]
  node_epg_store["EPG store<br/>[epg.js]"]
  node_epg_worker["XMLTV parser<br/>[epgWorker.js]"]
  node_player["Stream player<br/>[player.js]"]
  node_proxy_helper["Proxy routing<br/>[proxy.js]"]
end

subgraph group_proxy["Stream proxy"]
  node_proxy_worker["Proxy worker<br/>[worker.js]"]
end

node_viewer(("Viewer"))
node_browser_user(("Browser viewer"))
node_upstream_stream["Stream origin"]

node_browser_user -->|"uses"| node_web_app
node_web_app -->|"loads playlist"| node_playlist_outputs
node_web_app -->|"parses channels"| node_m3u_parser
node_web_app -->|"loads guide"| node_epg_store
node_epg_store -->|"starts worker"| node_epg_worker
node_epg_worker -.->|"fetches XMLTV"| node_epg_output
node_web_app -->|"starts playback"| node_player
node_player -->|"routes streams"| node_proxy_helper
node_proxy_helper -->|"configures endpoint"| node_proxy_worker
node_proxy_worker -->|"fetches stream"| node_upstream_stream
node_playlist_pipeline -.->|"runs stages"| node_source_merge
node_playlist_pipeline -.->|"runs stages"| node_extra_merge
node_playlist_pipeline -.->|"runs stages"| node_international_merge
node_playlist_pipeline -.->|"runs stages"| node_astatv_merge
node_playlist_pipeline -.->|"runs stages"| node_cleanup
node_playlist_pipeline -.->|"runs stages"| node_repair
node_playlist_pipeline -.->|"runs stages"| node_clearkey_fix
node_playlist_pipeline -.->|"runs stages"| node_tag_fix
node_playlist_pipeline -.->|"runs stages"| node_group_normalize
node_playlist_pipeline -.->|"runs stages"| node_dash_tag
node_playlist_pipeline -.->|"runs stages"| node_protected_apply
node_playlist_pipeline -.->|"runs stages"| node_channel_sort
node_playlist_pipeline -.->|"runs stages"| node_televizo
node_playlist_pipeline -.->|"generates guide"| node_epg_generation
node_playlist_pipeline -.->|"updates guide"| node_epg_append
node_channel_sort -->|"provides sorting"| node_televizo
node_playlist_pipeline -.->|"publishes playlists"| node_playlist_outputs
node_epg_generation -.->|"writes guide"| node_epg_output
node_epg_append -.->|"updates guide"| node_epg_output
node_viewer -->|"uses playlist"| node_playlist_outputs
node_viewer -->|"uses guide"| node_epg_output

click node_playlist_pipeline "https://github.com/dhasap/dhanytv/blob/main/update-script/update_playlist.sh"
click node_source_merge "https://github.com/dhasap/dhanytv/blob/main/update-script/merge_source.py"
click node_extra_merge "https://github.com/dhasap/dhanytv/blob/main/update-script/merge_extra.py"
click node_international_merge "https://github.com/dhasap/dhanytv/blob/main/update-script/merge_international.py"
click node_astatv_merge "https://github.com/dhasap/dhanytv/blob/main/update-script/merge_astatv.py"
click node_cleanup "https://github.com/dhasap/dhanytv/blob/main/update-script/cleanup_playlist.py"
click node_repair "https://github.com/dhasap/dhanytv/blob/main/update-script/repair_playlist.py"
click node_clearkey_fix "https://github.com/dhasap/dhanytv/blob/main/update-script/fix_clearkeys.py"
click node_tag_fix "https://github.com/dhasap/dhanytv/blob/main/update-script/fix_tags.py"
click node_group_normalize "https://github.com/dhasap/dhanytv/blob/main/update-script/normalize_groups.py"
click node_dash_tag "https://github.com/dhasap/dhanytv/blob/main/update-script/tag_dash.py"
click node_protected_apply "https://github.com/dhasap/dhanytv/blob/main/update-script/apply_protected.py"
click node_channel_sort "https://github.com/dhasap/dhanytv/blob/main/update-script/sort_channels.py"
click node_televizo "https://github.com/dhasap/dhanytv/blob/main/update-script/make_televizo.py"
click node_playlist_outputs "https://github.com/dhasap/dhanytv/blob/main/dhanytv.m3u"
click node_epg_generation "https://github.com/dhasap/dhanytv/blob/main/update-script/generate_epg.py"
click node_epg_append "https://github.com/dhasap/dhanytv/blob/main/update-script/append_epg.py"
click node_epg_output "https://github.com/dhasap/dhanytv/blob/main/epg.xml"
click node_web_app "https://github.com/dhasap/dhanytv/blob/main/web/src/main.js"
click node_m3u_parser "https://github.com/dhasap/dhanytv/blob/main/web/src/lib/m3u.js"
click node_epg_store "https://github.com/dhasap/dhanytv/blob/main/web/src/lib/epg.js"
click node_epg_worker "https://github.com/dhasap/dhanytv/blob/main/web/src/lib/epgWorker.js"
click node_player "https://github.com/dhasap/dhanytv/blob/main/web/src/lib/player.js"
click node_proxy_helper "https://github.com/dhasap/dhanytv/blob/main/web/src/lib/proxy.js"
click node_proxy_worker "https://github.com/dhasap/dhanytv/blob/main/web/proxy/worker.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_playlist_pipeline,node_source_merge,node_extra_merge,node_international_merge,node_astatv_merge,node_cleanup,node_repair,node_clearkey_fix,node_tag_fix,node_group_normalize,node_dash_tag,node_protected_apply,node_channel_sort,node_televizo,node_playlist_outputs,node_viewer,node_browser_user toneBlue
class node_epg_generation,node_epg_append,node_epg_output toneAmber
class node_web_app,node_m3u_parser,node_epg_store,node_epg_worker,node_player,node_proxy_helper toneMint
class node_proxy_worker toneRose
class node_upstream_stream toneIndigo
```

## Components

### Playlist curation

- [Playlist update](https://github.com/dhasap/dhanytv/blob/main/update-script/update_playlist.sh): `update-script/update_playlist.sh`
- [Source merging](https://github.com/dhasap/dhanytv/blob/main/update-script/merge_source.py): `update-script/merge_source.py`
- [Extra channels](https://github.com/dhasap/dhanytv/blob/main/update-script/merge_extra.py): `update-script/merge_extra.py`
- [International channels](https://github.com/dhasap/dhanytv/blob/main/update-script/merge_international.py): `update-script/merge_international.py`
- [Astatv merge](https://github.com/dhasap/dhanytv/blob/main/update-script/merge_astatv.py): `update-script/merge_astatv.py`
- [Playlist cleanup](https://github.com/dhasap/dhanytv/blob/main/update-script/cleanup_playlist.py): `update-script/cleanup_playlist.py`
- [Playlist repair](https://github.com/dhasap/dhanytv/blob/main/update-script/repair_playlist.py): `update-script/repair_playlist.py`
- [ClearKey fixes](https://github.com/dhasap/dhanytv/blob/main/update-script/fix_clearkeys.py): `update-script/fix_clearkeys.py`
- [Tag fixes](https://github.com/dhasap/dhanytv/blob/main/update-script/fix_tags.py): `update-script/fix_tags.py`
- [Group normalization](https://github.com/dhasap/dhanytv/blob/main/update-script/normalize_groups.py): `update-script/normalize_groups.py`
- [DASH tagging](https://github.com/dhasap/dhanytv/blob/main/update-script/tag_dash.py): `update-script/tag_dash.py`
- [Protected channels](https://github.com/dhasap/dhanytv/blob/main/update-script/apply_protected.py): `update-script/apply_protected.py`
- [Popularity sorting](https://github.com/dhasap/dhanytv/blob/main/update-script/sort_channels.py): `update-script/sort_channels.py`
- [Televizo variants](https://github.com/dhasap/dhanytv/blob/main/update-script/make_televizo.py): `update-script/make_televizo.py`
- [M3U playlists](https://github.com/dhasap/dhanytv/blob/main/dhanytv.m3u): `dhanytv.m3u`

### EPG guide

- [EPG generation](https://github.com/dhasap/dhanytv/blob/main/update-script/generate_epg.py): `update-script/generate_epg.py`
- [EPG append](https://github.com/dhasap/dhanytv/blob/main/update-script/append_epg.py): `update-script/append_epg.py`
- [XMLTV guide](https://github.com/dhasap/dhanytv/blob/main/epg.xml): `epg.xml`

### Web playback

- [Web app](https://github.com/dhasap/dhanytv/blob/main/web/src/main.js): `web/src/main.js`
- [M3U parser](https://github.com/dhasap/dhanytv/blob/main/web/src/lib/m3u.js): `web/src/lib/m3u.js`
- [EPG store](https://github.com/dhasap/dhanytv/blob/main/web/src/lib/epg.js): `web/src/lib/epg.js`
- [XMLTV parser](https://github.com/dhasap/dhanytv/blob/main/web/src/lib/epgWorker.js): `web/src/lib/epgWorker.js`
- [Stream player](https://github.com/dhasap/dhanytv/blob/main/web/src/lib/player.js): `web/src/lib/player.js`
- [Proxy routing](https://github.com/dhasap/dhanytv/blob/main/web/src/lib/proxy.js): `web/src/lib/proxy.js`

### Stream proxy

- [Proxy worker](https://github.com/dhasap/dhanytv/blob/main/web/proxy/worker.js): `web/proxy/worker.js`

### Other components

- **Viewer**
- **Browser viewer**
- **Stream origin**

## Connections

- Browser viewer → Web app: uses (evidence: `README.md`)
- Web app → M3U playlists: loads playlist (evidence: `web/src/main.js`)
- Web app → M3U parser: parses channels (evidence: `web/src/main.js`)
- Web app → EPG store: loads guide (evidence: `web/src/main.js`)
- EPG store → XMLTV parser: starts worker (evidence: `web/src/lib/epg.js`)
- XMLTV parser → XMLTV guide: fetches XMLTV
- Web app → Stream player: starts playback (evidence: `web/src/main.js`)
- Stream player → Proxy routing: routes streams (evidence: `web/src/lib/player.js`)
- Proxy routing → Proxy worker: configures endpoint (evidence: `web/src/lib/proxy.js`)
- Proxy worker → Stream origin: fetches stream (evidence: `web/proxy/worker.js`)
- Playlist update → Source merging: runs stages
- Playlist update → Extra channels: runs stages
- Playlist update → International channels: runs stages
- Playlist update → Astatv merge: runs stages
- Playlist update → Playlist cleanup: runs stages
- Playlist update → Playlist repair: runs stages
- Playlist update → ClearKey fixes: runs stages
- Playlist update → Tag fixes: runs stages
- Playlist update → Group normalization: runs stages
- Playlist update → DASH tagging: runs stages
- Playlist update → Protected channels: runs stages
- Playlist update → Popularity sorting: runs stages
- Playlist update → Televizo variants: runs stages
- Playlist update → EPG generation: generates guide
- Playlist update → EPG append: updates guide
- Popularity sorting → Televizo variants: provides sorting (evidence: `update-script/make_televizo.py`)
- Playlist update → M3U playlists: publishes playlists
- EPG generation → XMLTV guide: writes guide
- EPG append → XMLTV guide: updates guide
- Viewer → M3U playlists: uses playlist (evidence: `README.md`)
- Viewer → XMLTV guide: uses guide (evidence: `README.md`)
