# simon-weber/gmusicapi architecture

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

- Interactive diagram: https://gitdiagram.com/simon-weber/gmusicapi
- Repository: https://github.com/simon-weber/gmusicapi

## Overview

gmusicapi is a Python client library for controlling Google Play Music. A caller creates a Mobileclient, Musicmanager, or Webclient, authenticates, and invokes library, playlist, search, streaming, or upload operations; clients delegate requests to protocol definitions and the session transport, then return parsed results. The graph includes the documented client capabilities and shared request/authentication layers. Source excerpts show selected paths only, so omitted implementation details and unverified connections are not inferred.

Main entry points: [`gmusicapi/clients/shared.py`](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/shared.py) (Client Base), [`gmusicapi/protocol/shared.py`](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/shared.py) (Call Framework), [`gmusicapi/clients/musicmanager.py`](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/musicmanager.py) (Musicmanager), [`gmusicapi/clients/mobileclient.py`](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/mobileclient.py) (Mobileclient)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["Client APIs"]
  node_mobile["Mobileclient<br/>[mobileclient.py]"]
  node_manager["Musicmanager<br/>[musicmanager.py]"]
  node_web["Webclient<br/>[webclient.py]"]
end

subgraph group_protocol["Service Protocols"]
  node_mproto["Mobile Calls<br/>[mobileclient.py]"]
  node_mmproto["Upload Calls<br/>[musicmanager.py]"]
  node_wproto["Web Calls<br/>[webclient.py]"]
  node_protocolshared["Call Framework<br/>[shared.py]"]
end

subgraph group_transport["Auth and Transport"]
  node_clientbase["Client Base<br/>[shared.py]"]
  node_session["Session Transport<br/>[session.py]"]
end

subgraph group_support["Shared Support"]
  node_utils["Utilities<br/>[utils.py]"]
  node_jsarray["JS Array Parser<br/>[jsarray.py]"]
  node_appdirs["App Directories<br/>[appdirs.py]"]
  node_errors["API Exceptions<br/>[exceptions.py]"]
  node_version["Version Metadata<br/>[_version.py]"]
  node_tools["Management Tools<br/>[tools.py]"]
end

node_caller(("Library Caller"))
node_google["Google Play Music"]

node_caller -->|"calls"| node_mobile
node_caller -.->|"calls"| node_manager
node_caller -.->|"calls"| node_web
node_mobile -.->|"inherits"| node_clientbase
node_manager -->|"inherits"| node_clientbase
node_web -->|"inherits"| node_clientbase
node_mobile -->|"invokes"| node_mproto
node_manager -->|"invokes"| node_mmproto
node_web -->|"invokes"| node_wproto
node_clientbase -->|"creates"| node_session
node_mproto -->|"uses"| node_protocolshared
node_mmproto -->|"uses"| node_protocolshared
node_wproto -->|"uses"| node_protocolshared
node_protocolshared -->|"sends requests"| node_session
node_session -->|"transports requests"| node_google
node_wproto -->|"parses responses"| node_jsarray
node_clientbase -->|"configures logging"| node_utils
node_manager -->|"transcodes audio"| node_utils
node_clientbase -.->|"uses paths"| node_appdirs
node_protocolshared -->|"raises errors"| node_errors
node_mmproto -->|"raises errors"| node_errors
node_caller -.->|"uses"| node_tools

click node_mobile "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/mobileclient.py"
click node_manager "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/musicmanager.py"
click node_web "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/webclient.py"
click node_mproto "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/mobileclient.py"
click node_mmproto "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/musicmanager.py"
click node_wproto "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/webclient.py"
click node_protocolshared "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/shared.py"
click node_clientbase "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/shared.py"
click node_session "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/session.py"
click node_utils "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/utils/utils.py"
click node_jsarray "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/utils/jsarray.py"
click node_appdirs "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/appdirs.py"
click node_errors "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/exceptions.py"
click node_version "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/_version.py"
click node_tools "https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/gmtools/tools.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_mobile,node_manager,node_web toneBlue
class node_mproto,node_mmproto,node_wproto,node_protocolshared toneAmber
class node_clientbase,node_session toneMint
class node_utils,node_jsarray,node_appdirs,node_errors,node_version,node_tools toneRose
class node_caller,node_google toneIndigo
```

## Components

### Client APIs

- [Mobileclient](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/mobileclient.py): `gmusicapi/clients/mobileclient.py`
- [Musicmanager](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/musicmanager.py): `gmusicapi/clients/musicmanager.py`
- [Webclient](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/webclient.py): `gmusicapi/clients/webclient.py`

### Service Protocols

- [Mobile Calls](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/mobileclient.py): `gmusicapi/protocol/mobileclient.py`
- [Upload Calls](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/musicmanager.py): `gmusicapi/protocol/musicmanager.py`
- [Web Calls](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/webclient.py): `gmusicapi/protocol/webclient.py`
- [Call Framework](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/protocol/shared.py): `gmusicapi/protocol/shared.py`

### Auth and Transport

- [Client Base](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/clients/shared.py): `gmusicapi/clients/shared.py`
- [Session Transport](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/session.py): `gmusicapi/session.py`

### Shared Support

- [Utilities](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/utils/utils.py): `gmusicapi/utils/utils.py`
- [JS Array Parser](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/utils/jsarray.py): `gmusicapi/utils/jsarray.py`
- [App Directories](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/appdirs.py): `gmusicapi/appdirs.py`
- [API Exceptions](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/exceptions.py): `gmusicapi/exceptions.py`
- [Version Metadata](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/_version.py): `gmusicapi/_version.py`
- [Management Tools](https://github.com/simon-weber/gmusicapi/blob/develop/gmusicapi/gmtools/tools.py): `gmusicapi/gmtools/tools.py`

### Other components

- **Library Caller**
- **Google Play Music**

## Connections

- Library Caller → Mobileclient: calls (evidence: `README.rst`)
- Library Caller → Musicmanager: calls
- Library Caller → Webclient: calls
- Mobileclient → Client Base: inherits (evidence: `gmusicapi/clients/mobileclient.py`)
- Musicmanager → Client Base: inherits (evidence: `gmusicapi/clients/musicmanager.py`)
- Webclient → Client Base: inherits (evidence: `gmusicapi/clients/webclient.py`)
- Mobileclient → Mobile Calls: invokes (evidence: `gmusicapi/clients/mobileclient.py`)
- Musicmanager → Upload Calls: invokes (evidence: `gmusicapi/clients/musicmanager.py`)
- Webclient → Web Calls: invokes (evidence: `gmusicapi/clients/webclient.py`)
- Client Base → Session Transport: creates (evidence: `gmusicapi/clients/shared.py`)
- Mobile Calls → Call Framework: uses (evidence: `gmusicapi/protocol/mobileclient.py`)
- Upload Calls → Call Framework: uses (evidence: `gmusicapi/protocol/musicmanager.py`)
- Web Calls → Call Framework: uses (evidence: `gmusicapi/protocol/webclient.py`)
- Call Framework → Session Transport: sends requests (evidence: `gmusicapi/protocol/shared.py`)
- Session Transport → Google Play Music: transports requests (evidence: `gmusicapi/session.py`)
- Web Calls → JS Array Parser: parses responses (evidence: `gmusicapi/protocol/webclient.py`)
- Client Base → Utilities: configures logging (evidence: `gmusicapi/clients/shared.py`)
- Musicmanager → Utilities: transcodes audio (evidence: `gmusicapi/clients/musicmanager.py`)
- Client Base → App Directories: uses paths
- Call Framework → API Exceptions: raises errors (evidence: `gmusicapi/protocol/shared.py`)
- Upload Calls → API Exceptions: raises errors (evidence: `gmusicapi/protocol/musicmanager.py`)
- Library Caller → Management Tools: uses
