# mrjcfire2/plex2netflix architecture

> Architecture diagram of the GitHub repository mrjcfire2/plex2netflix, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mrjcfire2/plex2netflix
- Repository: https://github.com/mrjcfire2/plex2netflix

## Overview

##### Main Components Identification
The system consists of these key components:

- CLI Interface
- Core Service
- External APIs Integration (Plex and uNoGS)
- Report Generation

##### Component Relationships

**[CLI Input] → [Core Service]**
- ↓
**[Plex API] ← [API Handler] → [uNoGS API]**
- ↓
- [Data Processor]
- ↓
- [Report Generator]
- ↓
- [Console Output]

##### Important Details

a) Data Flow Annotations:
- Media list retrieval from Plex
- IMDb ID extraction
- Netflix availability checking
- Results aggregation
- Report generation

b) Key Processing Steps:
- IMDb ID-based search path
- Title/year-based fallback search path
- Filtering options (year, section)

##### Technical Stack Elements

- Node.js runtime (v4.0+)
- Plex Web API
- uNoGS API
- Command-line interface

##### Implementation Details

**lib/**
- apis/
- plex2netflix-server.js (API integration)
- cli.js (Command interface)
- index.js (Core service)
- report/
- console.js (Output formatting)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef cli fill:#3498db,stroke:#2980b9,color:white
    classDef core fill:#2ecc71,stroke:#27ae60,color:white
    classDef api fill:#e67e22,stroke:#d35400,color:white
    classDef output fill:#9b59b6,stroke:#8e44ad,color:white
    
    %% Input Layer
    CLI[Command Line Interface]:::cli
    click CLI "https://github.com/MrJcfire2/plex2netflix/blob/master/lib/cli.js"
    
    %% Core Processing Layer
    CoreService[Core Service]:::core
    click CoreService "https://github.com/MrJcfire2/plex2netflix/blob/master/lib/index.js"
    APIHandler[API Integration Handler]:::core
    click APIHandler "https://github.com/MrJcfire2/plex2netflix/blob/master/lib/apis/plex2netflix-server.js"
    DataProcessor[Data Processor]:::core
    
    %% External Services Layer
    subgraph External
        PlexAPI[Plex Server API]:::api
        uNoGSAPI[uNoGS Netflix API]:::api
    end
    
    %% Output Layer
    ReportGen[Report Generator]:::output
    click ReportGen "https://github.com/MrJcfire2/plex2netflix/blob/master/lib/report/console.js"
    ConsoleOut[Console Output]:::output
    
    %% Connections
    CLI --> |"Input Parameters<br>(host, token, country)"| CoreService
    CoreService --> APIHandler
    APIHandler --> PlexAPI
    APIHandler --> uNoGSAPI
    APIHandler --> |"Media Data"| DataProcessor
    DataProcessor --> |"Processed Results"| ReportGen
    ReportGen --> ConsoleOut
    
    %% Legend
    subgraph Legend
        CLI_L[User Interface]:::cli
        CORE_L[Core Components]:::core
        API_L[External APIs]:::api
        OUT_L[Output Components]:::output
    end
```
