# lizongying/my-tv architecture

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

- Interactive diagram: https://gitdiagram.com/lizongying/my-tv
- Repository: https://github.com/lizongying/my-tv

## Overview

MyTV is an Android TV live-channel player. The main workflow is remote-control selection in the channel browser, followed by request orchestration to obtain playback information and URLs, then playback and display of channel data. The app also retrieves EPG data through several provider-specific protocols and includes a user-triggered release-update flow. The excerpts show UI dispatch, model behavior, selected service contracts, and update handling; many API calls and player internals are unsampled, so those connections are left unverified.

Main entry points: [`app/src/main/java/com/lizongying/mytv/Request.kt`](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/Request.kt) (Request orchestration), [`app/src/main/java/com/lizongying/mytv/MainFragment.kt`](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/MainFragment.kt) (Channel browser), [`app/src/main/java/com/lizongying/mytv/models/TVViewModel.kt`](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/models/TVViewModel.kt) (Channel state), [`app/src/main/java/com/lizongying/mytv/UpdateManager.kt`](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/UpdateManager.kt) (Update manager)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["TV interface"]
  node_activity["App activity<br/>[MainActivity.kt]"]
  node_browser["Channel browser<br/>[MainFragment.kt]"]
  node_settings["Settings<br/>[SettingFragment.kt]"]
  node_tvlist["Channel catalog<br/>[TVList.kt]"]
end

subgraph group_playback["Channel playback"]
  node_state["Channel state<br/>[TVViewModel.kt]"]
  node_request["Request orchestration<br/>[Request.kt]"]
  node_player["Video player<br/>[PlayerFragment.kt]"]
  node_epg["Program guide<br/>[EPG.kt]"]
end

subgraph group_services["Provider services"]
  node_api["API client<br/>[ApiClient.kt]"]
  node_ysp["Yangshipin API<br/>[YSP.kt]"]
  node_liveapi["Live API<br/>[YSPApiService.kt]"]
  node_protoapi["Proto EPG API<br/>[YSPProtoService.kt]"]
  node_jceapi["JCE EPG API<br/>[YSPJceService.kt]"]
  node_fapi["F-provider API<br/>[FAuthService.kt]"]
  node_btrace["Playback reporting"]
end

subgraph group_update["Release updates"]
  node_update_manager["Update manager<br/>[UpdateManager.kt]"]
  node_release_api["Release service<br/>[ReleaseService.kt]"]
  node_download["Android downloader"]
end

node_viewer(("TV viewer"))
node_external{{"Provider servers"}}

node_viewer -->|"operates"| node_activity
node_activity -->|"hosts"| node_browser
node_browser -->|"fetches data"| node_request
node_browser -->|"updates selection"| node_state
node_browser -->|"builds rows"| node_tvlist
node_request -.->|"updates URLs and guide"| node_state
node_state -->|"supplies playback state"| node_player
node_state -->|"maps guide entries"| node_epg
node_request -.->|"uses client"| node_api
node_request -.->|"coordinates provider requests"| node_ysp
node_ysp -.->|"configures"| node_liveapi
node_request -.->|"requests guide"| node_protoapi
node_request -.->|"requests guide"| node_jceapi
node_request -.->|"requests auth and guide"| node_fapi
node_request -.->|"sends reports"| node_btrace
node_liveapi -.->|"calls"| node_external
node_protoapi -.->|"calls"| node_external
node_jceapi -.->|"calls"| node_external
node_fapi -.->|"calls"| node_external
node_btrace -.->|"reports to"| node_external
node_settings -->|"initiates update"| node_update_manager
node_update_manager -.->|"checks release"| node_release_api
node_update_manager -->|"queues APK"| node_download
node_release_api -.->|"checks release"| node_external

click node_activity "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/MainActivity.kt"
click node_browser "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/MainFragment.kt"
click node_settings "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/SettingFragment.kt"
click node_tvlist "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/TVList.kt"
click node_state "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/models/TVViewModel.kt"
click node_request "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/Request.kt"
click node_player "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/PlayerFragment.kt"
click node_epg "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/models/EPG.kt"
click node_api "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/ApiClient.kt"
click node_ysp "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSP.kt"
click node_liveapi "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPApiService.kt"
click node_protoapi "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPProtoService.kt"
click node_jceapi "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPJceService.kt"
click node_fapi "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/FAuthService.kt"
click node_btrace "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPBtraceService.kt"
click node_update_manager "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/UpdateManager.kt"
click node_release_api "https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/ReleaseService.kt"

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_activity,node_browser,node_settings,node_tvlist,node_viewer toneBlue
class node_state,node_request,node_player,node_epg toneAmber
class node_api,node_ysp,node_liveapi,node_protoapi,node_jceapi,node_fapi,node_btrace,node_external toneMint
class node_update_manager,node_release_api,node_download toneRose
```

## Components

### TV interface

- [App activity](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/MainActivity.kt): `app/src/main/java/com/lizongying/mytv/MainActivity.kt`
- [Channel browser](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/MainFragment.kt): `app/src/main/java/com/lizongying/mytv/MainFragment.kt`
- [Settings](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/SettingFragment.kt): `app/src/main/java/com/lizongying/mytv/SettingFragment.kt`
- [Channel catalog](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/TVList.kt): `app/src/main/java/com/lizongying/mytv/TVList.kt`

### Channel playback

- [Channel state](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/models/TVViewModel.kt): `app/src/main/java/com/lizongying/mytv/models/TVViewModel.kt`
- [Request orchestration](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/Request.kt): `app/src/main/java/com/lizongying/mytv/Request.kt`
- [Video player](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/PlayerFragment.kt): `app/src/main/java/com/lizongying/mytv/PlayerFragment.kt`
- [Program guide](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/models/EPG.kt): `app/src/main/java/com/lizongying/mytv/models/EPG.kt`

### Provider services

- [API client](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/ApiClient.kt): `app/src/main/java/com/lizongying/mytv/api/ApiClient.kt`
- [Yangshipin API](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSP.kt): `app/src/main/java/com/lizongying/mytv/api/YSP.kt`
- [Live API](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPApiService.kt): `app/src/main/java/com/lizongying/mytv/api/YSPApiService.kt`
- [Proto EPG API](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPProtoService.kt): `app/src/main/java/com/lizongying/mytv/api/YSPProtoService.kt`
- [JCE EPG API](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPJceService.kt): `app/src/main/java/com/lizongying/mytv/api/YSPJceService.kt`
- [F-provider API](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/FAuthService.kt): `app/src/main/java/com/lizongying/mytv/api/FAuthService.kt`
- [Playback reporting](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/YSPBtraceService.kt): `app/src/main/java/com/lizongying/mytv/api/YSPBtraceService.kt`

### Release updates

- [Update manager](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/UpdateManager.kt): `app/src/main/java/com/lizongying/mytv/UpdateManager.kt`
- [Release service](https://github.com/lizongying/my-tv/blob/main/app/src/main/java/com/lizongying/mytv/api/ReleaseService.kt): `app/src/main/java/com/lizongying/mytv/api/ReleaseService.kt`
- **Android downloader**

### Other components

- **TV viewer**
- **Provider servers**

## Connections

- TV viewer → App activity: operates (evidence: `app/src/main/java/com/lizongying/mytv/MainActivity.kt`)
- App activity → Channel browser: hosts (evidence: `app/src/main/java/com/lizongying/mytv/MainActivity.kt`)
- Channel browser → Request orchestration: fetches data (evidence: `app/src/main/java/com/lizongying/mytv/MainFragment.kt`)
- Channel browser → Channel state: updates selection (evidence: `app/src/main/java/com/lizongying/mytv/MainFragment.kt`)
- Channel browser → Channel catalog: builds rows (evidence: `app/src/main/java/com/lizongying/mytv/MainFragment.kt`)
- Request orchestration → Channel state: updates URLs and guide (evidence: `app/src/main/java/com/lizongying/mytv/Request.kt`)
- Channel state → Video player: supplies playback state (evidence: `app/src/main/java/com/lizongying/mytv/PlayerFragment.kt`)
- Channel state → Program guide: maps guide entries (evidence: `app/src/main/java/com/lizongying/mytv/models/TVViewModel.kt`)
- Request orchestration → API client: uses client (evidence: `app/src/main/java/com/lizongying/mytv/Request.kt`)
- Request orchestration → Yangshipin API: coordinates provider requests (evidence: `app/src/main/java/com/lizongying/mytv/Request.kt`)
- Yangshipin API → Live API: configures
- Request orchestration → Proto EPG API: requests guide (evidence: `app/src/main/java/com/lizongying/mytv/Request.kt`)
- Request orchestration → JCE EPG API: requests guide (evidence: `app/src/main/java/com/lizongying/mytv/Request.kt`)
- Request orchestration → F-provider API: requests auth and guide (evidence: `app/src/main/java/com/lizongying/mytv/Request.kt`)
- Request orchestration → Playback reporting: sends reports (evidence: `app/src/main/java/com/lizongying/mytv/Request.kt`)
- Live API → Provider servers: calls
- Proto EPG API → Provider servers: calls
- JCE EPG API → Provider servers: calls
- F-provider API → Provider servers: calls
- Playback reporting → Provider servers: reports to
- Settings → Update manager: initiates update (evidence: `app/src/main/java/com/lizongying/mytv/SettingFragment.kt`)
- Update manager → Release service: checks release
- Update manager → Android downloader: queues APK (evidence: `app/src/main/java/com/lizongying/mytv/UpdateManager.kt`)
- Release service → Provider servers: checks release
