# chamchenko/plugin.video.nbainternational architecture

> Architecture diagram of the GitHub repository chamchenko/plugin.video.nbainternational, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/chamchenko/plugin.video.nbainternational
- Repository: https://github.com/chamchenko/plugin.video.nbainternational

## Overview

##### Main Components

a. Client Layer:
- Kodi Media Center
- NBA League Pass Plugin (your addon)

b. Service Layer:
- NBA International League Pass API
- NBA Content Delivery Network (CDN)

c. Authentication Layer:
- NBA League Pass Authentication Service

##### Core Plugin Components (based on the lib directory)

- Main Controller (main.py)
- Authentication Handler (auth.py)
- Content Handlers:
- Games Handler (games.py)
- NBA TV Handler (nba_tv.py)
- Video Handler (videos.py)
- Series Handler (series.py)
- Players/Teams Handler (players_teams.py)
- Search Handler (search.py)

##### Key Relationships

a. User Flow:
- Kodi UI → Plugin Main Controller
- Main Controller → Specific Handlers
- Handlers → NBA APIs

b. Authentication Flow:
- Auth Handler → NBA Authentication Service
- Auth Token distribution to other handlers

##### Additional Elements

A configuration section showing:
- Settings.xml integration
- Language resource files
- Media resources

##### Important Notes

- A clear distinction between local (plugin) components and external (NBA) services
- How the tools.py and vars.py support other modules
- Where content caching might occur
- Points where user credentials are required

##### Technical Details

- Protocol indicators (HTTPS, streaming protocols)
- Content type indicators (Live streams, VOD, metadata)
- Configuration dependencies

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Entities
    User([User]):::user
    NBAAuth([NBA Auth Service]):::external
    NBAServices([NBA League Pass Services]):::external
    KodiPlayer([Kodi Media Player]):::external

    %% Main Plugin Components
    subgraph Plugin[NBA League Pass Plugin]
        EntryPoint[Plugin Entry Point]:::core
        click EntryPoint "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/default.py"
        
        Config[Plugin Configuration]:::core
        click Config "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/addon.xml"
        
        CoreLogic[Core Plugin Logic]:::core
        click CoreLogic "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/main.py"

        subgraph AuthProcess[Authentication Process]
            Auth[Authentication Handler]:::auth
            click Auth "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/auth.py"
            SysVars[System Variables]:::util
            click SysVars "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/vars.py"
        end

        subgraph ContentProcesses[Content Processes]
            Games[Live Games]:::content
            click Games "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/games.py"
            NBATV[NBA TV Stream]:::content
            click NBATV "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/nba_tv.py"
            Videos[Video Collections]:::content
            click Videos "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/videos.py"
            Teams[Team/Player Content]:::content
            click Teams "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/players_teams.py"
            Series[Series Content]:::content
            click Series "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/series.py"
            Search[Search Function]:::content
            click Search "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/search.py"
        end

        subgraph DataStores[Data Stores]
            Settings[(Settings Store)]:::store
            click Settings "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/settings.xml"
            Language[(Language Resources)]:::store
            click Language "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/language/resource.language.en_gb/strings.po"
            Media[(Media Assets)]:::store
            click Media "https://github.com/chamchenko/plugin.video.nbainternational/tree/dev/resources/media"
        end

        Utils[Utility Functions]:::util
        click Utils "https://github.com/chamchenko/plugin.video.nbainternational/blob/dev/resources/lib/tools.py"
    end

    %% Data Flows
    User --> EntryPoint
    EntryPoint --> CoreLogic
    CoreLogic --> Auth
    Auth --> NBAAuth
    NBAAuth --> Auth
    Auth --> SysVars
    CoreLogic --> ContentProcesses
    ContentProcesses --> NBAServices
    NBAServices --> ContentProcesses
    ContentProcesses --> KodiPlayer
    KodiPlayer --> User
    DataStores --> ContentProcesses
    Utils --> ContentProcesses
    Utils --> Auth

    %% Styles
    classDef user fill:#7CB9E8
    classDef external fill:#FF6B6B
    classDef core fill:#4CAF50
    classDef auth fill:#FFD700
    classDef content fill:#FF9800
    classDef store fill:#A9A9A9
    classDef util fill:#9C27B0

    %% Legend
    subgraph Legend
        U[User Interface]:::user
        E[External Services]:::external
        C[Core Components]:::core
        A[Authentication]:::auth
        CP[Content Processors]:::content
        S[(Data Stores)]:::store
        UT[Utilities]:::util
    end
```
