# lastperson07/jiosaavn-cli architecture

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

- Interactive diagram: https://gitdiagram.com/lastperson07/jiosaavn-cli
- Repository: https://github.com/lastperson07/jiosaavn-cli

## Overview

JioSaavn CLI is a menu-driven terminal client for searching and browsing music, radio, and podcasts, then downloading selected media. The main workflow runs from the interactive session through discovery and selection, song resolution, bitrate selection, signed URL retrieval, and local file writing. The README documents the broader home sections and supported link types; several internal details are in omitted portions of the single source file, so the graph groups those responsibilities without asserting unshown calls.

Main entry points: [`jiosaavn.py`](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py) (API requests)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Terminal interface"]
  node_cli["Session loop<br/>[jiosaavn.py]"]
  node_home_menu["Home menu<br/>[jiosaavn.py]"]
  node_browse["Browse and select<br/>[jiosaavn.py]"]
  node_fetch["Fetch selection<br/>[jiosaavn.py]"]
end

subgraph group_discovery["Content discovery"]
  node_search["Song search<br/>[jiosaavn.py]"]
  node_home_content["Home content<br/>[jiosaavn.py]"]
  node_radio["Radio queue<br/>[jiosaavn.py]"]
  node_podcasts["Podcast episodes<br/>[jiosaavn.py]"]
  node_link_resolution["Link and ID resolution<br/>[jiosaavn.py]"]
end

subgraph group_media["Resolution and downloads"]
  node_api_client["API requests<br/>[jiosaavn.py]"]
  node_entry_resolution["Entry resolution<br/>[jiosaavn.py]"]
  node_bitrate["Bitrate selection<br/>[jiosaavn.py]"]
  node_signed_url["Signed URL<br/>[jiosaavn.py]"]
  node_download["Download writer<br/>[jiosaavn.py]"]
  node_metadata["Optional metadata<br/>[jiosaavn.py]"]
end

node_user(("User"))
node_jiosaavn_api{{"JioSaavn API"}}
node_cdn{{"Media CDN"}}
node_downloads[("Downloads directory")]

node_user -->|"chooses actions"| node_cli
node_cli -->|"searches songs"| node_search
node_cli -->|"opens home"| node_home_menu
node_home_menu -->|"browses sections"| node_browse
node_cli -->|"browses radio"| node_browse
node_user -->|"provides links"| node_link_resolution
node_browse -->|"submits selection"| node_fetch
node_search -->|"requests results"| node_api_client
node_search -->|"passes songs"| node_fetch
node_home_content -->|"requests sections"| node_api_client
node_radio -->|"requests station queue"| node_api_client
node_podcasts -->|"requests episodes"| node_api_client
node_link_resolution -->|"resolves content"| node_api_client
node_fetch -->|"opens entries"| node_entry_resolution
node_entry_resolution -->|"loads station songs"| node_radio
node_entry_resolution -->|"loads show episodes"| node_podcasts
node_entry_resolution -->|"fetches collections"| node_api_client
node_api_client -->|"sends requests"| node_jiosaavn_api
node_fetch -->|"chooses bitrate"| node_bitrate
node_bitrate -->|"requests download URL"| node_signed_url
node_signed_url -->|"requests auth token"| node_api_client
node_signed_url -->|"provides signed URL"| node_cdn
node_fetch -->|"downloads tracks"| node_download
node_download -->|"streams media"| node_cdn
node_download -->|"writes media files"| node_downloads
node_download -->|"optionally writes JSON"| node_metadata
node_metadata -->|"saves alongside media"| node_downloads

click node_cli "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_home_menu "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_browse "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_fetch "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_search "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_home_content "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_radio "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_podcasts "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_link_resolution "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_api_client "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_entry_resolution "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_bitrate "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_signed_url "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_download "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"
click node_metadata "https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py"

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_cli,node_home_menu,node_browse,node_fetch,node_user toneBlue
class node_search,node_home_content,node_radio,node_podcasts,node_link_resolution,node_downloads toneAmber
class node_api_client,node_entry_resolution,node_bitrate,node_signed_url,node_download,node_metadata,node_jiosaavn_api toneMint
class node_cdn toneIndigo
```

## Components

### Terminal interface

- [Session loop](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Home menu](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Browse and select](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Fetch selection](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`

### Content discovery

- [Song search](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Home content](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Radio queue](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Podcast episodes](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Link and ID resolution](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`

### Resolution and downloads

- [API requests](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Entry resolution](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Bitrate selection](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Signed URL](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Download writer](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`
- [Optional metadata](https://github.com/lastperson07/jiosaavn-cli/blob/main/jiosaavn.py): `jiosaavn.py`

### Other components

- **User**
- **JioSaavn API**
- **Media CDN**
- **Downloads directory**

## Connections

- User → Session loop: chooses actions (evidence: `README.md`)
- Session loop → Song search: searches songs (evidence: `jiosaavn.py`)
- Session loop → Home menu: opens home (evidence: `jiosaavn.py`)
- Home menu → Browse and select: browses sections (evidence: `jiosaavn.py`)
- Session loop → Browse and select: browses radio (evidence: `README.md`)
- User → Link and ID resolution: provides links (evidence: `README.md`)
- Browse and select → Fetch selection: submits selection (evidence: `jiosaavn.py`)
- Song search → API requests: requests results (evidence: `jiosaavn.py`)
- Song search → Fetch selection: passes songs (evidence: `jiosaavn.py`)
- Home content → API requests: requests sections (evidence: `README.md`)
- Radio queue → API requests: requests station queue (evidence: `jiosaavn.py`)
- Podcast episodes → API requests: requests episodes (evidence: `jiosaavn.py`)
- Link and ID resolution → API requests: resolves content (evidence: `README.md`)
- Fetch selection → Entry resolution: opens entries (evidence: `jiosaavn.py`)
- Entry resolution → Radio queue: loads station songs (evidence: `jiosaavn.py`)
- Entry resolution → Podcast episodes: loads show episodes (evidence: `jiosaavn.py`)
- Entry resolution → API requests: fetches collections (evidence: `README.md`)
- API requests → JioSaavn API: sends requests (evidence: `README.md`)
- Fetch selection → Bitrate selection: chooses bitrate (evidence: `jiosaavn.py`)
- Bitrate selection → Signed URL: requests download URL (evidence: `jiosaavn.py`)
- Signed URL → API requests: requests auth token (evidence: `jiosaavn.py`)
- Signed URL → Media CDN: provides signed URL (evidence: `README.md`)
- Fetch selection → Download writer: downloads tracks (evidence: `jiosaavn.py`)
- Download writer → Media CDN: streams media (evidence: `README.md`)
- Download writer → Downloads directory: writes media files (evidence: `jiosaavn.py`)
- Download writer → Optional metadata: optionally writes JSON (evidence: `jiosaavn.py`)
- Optional metadata → Downloads directory: saves alongside media (evidence: `README.md`)
