# 124dev/lafm architecture

> Architecture diagram of the GitHub repository 124dev/lafm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/124dev/lafm
- Repository: https://github.com/124dev/lafm

## Overview

LAFM is a CLI for collecting Spotify tracks and scrobbling saved lists to Last.fm. Its main workflow loads configuration, obtains proxies and authenticates services, then lets the user scrape an artist or playlist into songlist files, or choose a saved list to submit. The excerpt shows the menu orchestration and these domain stages, but omits some function bodies, including the track submission implementation; links to external APIs and file output are based on documented capabilities and visible calls.

Main entry points: [`scrobble.py`](https://github.com/124dev/lafm/blob/main/scrobble.py) (Main menu), [`songlist`](https://github.com/124dev/lafm/tree/main/songlist) (Saved song lists)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_entry["Main menu<br/>[scrobble.py]"]
  node_config["Configuration<br/>[scrobble.py]"]
  node_proxyfetch["Proxy retrieval<br/>[scrobble.py]"]
  node_credentials["Service checks<br/>[scrobble.py]"]
end

subgraph group_spotify["Spotify extraction"]
  node_artist["Artist scraper<br/>[scrobble.py]"]
  node_playlist["Playlist extractor<br/>[scrobble.py]"]
  node_songlists["Saved song lists"]
end

subgraph group_scrobble["Last.fm scrobbling"]
  node_listmenu["List selection<br/>[scrobble.py]"]
  node_fileloader["Track file loader<br/>[scrobble.py]"]
  node_tracksubmit["Track scrobbler<br/>[scrobble.py]"]
end

node_user(("CLI user"))
node_spotifyapi{{"Spotify API"}}
node_lastfm{{"Last.fm API"}}
node_proxyscrape{{"ProxyScrape"}}

node_user -->|"runs"| node_entry
node_entry -->|"loads"| node_config
node_entry -->|"fetches"| node_proxyfetch
node_proxyfetch -->|"requests proxies"| node_proxyscrape
node_entry -->|"checks services"| node_credentials
node_credentials -->|"validates access"| node_spotifyapi
node_credentials -->|"authenticates"| node_lastfm
node_entry -->|"dispatches"| node_artist
node_entry -->|"dispatches"| node_playlist
node_artist -->|"searches catalog"| node_spotifyapi
node_playlist -->|"fetches tracks"| node_spotifyapi
node_artist -->|"writes tracks"| node_songlists
node_playlist -.->|"writes tracks"| node_songlists
node_entry -->|"dispatches"| node_listmenu
node_listmenu -->|"lists files"| node_songlists
node_listmenu -->|"selects file"| node_fileloader
node_fileloader -->|"reads tracks"| node_songlists
node_fileloader -->|"starts submissions"| node_tracksubmit
node_tracksubmit -->|"scrobbles tracks"| node_lastfm
node_tracksubmit -.->|"rotates proxies"| node_proxyscrape

click node_entry "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_config "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_proxyfetch "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_credentials "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_artist "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_playlist "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_songlists "https://github.com/124dev/lafm/tree/main/songlist"
click node_listmenu "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_fileloader "https://github.com/124dev/lafm/blob/main/scrobble.py"
click node_tracksubmit "https://github.com/124dev/lafm/blob/main/scrobble.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_entry,node_config,node_proxyfetch,node_credentials,node_user toneBlue
class node_artist,node_playlist,node_songlists toneAmber
class node_listmenu,node_fileloader,node_tracksubmit,node_spotifyapi,node_lastfm toneMint
class node_proxyscrape toneIndigo
```

## Components

### CLI workflow

- [Main menu](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`
- [Configuration](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`
- [Proxy retrieval](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`
- [Service checks](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`

### Spotify extraction

- [Artist scraper](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`
- [Playlist extractor](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`
- [Saved song lists](https://github.com/124dev/lafm/tree/main/songlist): `songlist`

### Last.fm scrobbling

- [List selection](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`
- [Track file loader](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`
- [Track scrobbler](https://github.com/124dev/lafm/blob/main/scrobble.py): `scrobble.py`

### Other components

- **CLI user**
- **Spotify API**
- **Last.fm API**
- **ProxyScrape**

## Connections

- CLI user → Main menu: runs (evidence: `README.md`)
- Main menu → Configuration: loads (evidence: `scrobble.py`)
- Main menu → Proxy retrieval: fetches (evidence: `scrobble.py`)
- Proxy retrieval → ProxyScrape: requests proxies (evidence: `scrobble.py`)
- Main menu → Service checks: checks services (evidence: `scrobble.py`)
- Service checks → Spotify API: validates access (evidence: `scrobble.py`)
- Service checks → Last.fm API: authenticates (evidence: `scrobble.py`)
- Main menu → Artist scraper: dispatches (evidence: `scrobble.py`)
- Main menu → Playlist extractor: dispatches (evidence: `scrobble.py`)
- Artist scraper → Spotify API: searches catalog (evidence: `scrobble.py`)
- Playlist extractor → Spotify API: fetches tracks (evidence: `scrobble.py`)
- Artist scraper → Saved song lists: writes tracks (evidence: `scrobble.py`)
- Playlist extractor → Saved song lists: writes tracks (evidence: `README.md`)
- Main menu → List selection: dispatches (evidence: `scrobble.py`)
- List selection → Saved song lists: lists files (evidence: `scrobble.py`)
- List selection → Track file loader: selects file (evidence: `scrobble.py`)
- Track file loader → Saved song lists: reads tracks (evidence: `scrobble.py`)
- Track file loader → Track scrobbler: starts submissions (evidence: `scrobble.py`)
- Track scrobbler → Last.fm API: scrobbles tracks (evidence: `README.md`)
- Track scrobbler → ProxyScrape: rotates proxies (evidence: `README.md`)
