How unkreativimweb/waitlist works
1. What this repo is
MOOD is a local, Python-based CLI for exploring Spotify music and generating recommendations. There is no hosted backend: the application runs on the user’s machine and talks directly to third-party APIs.
2. Runtime and entry point
src/main.py is the top-level orchestrator. It initializes environment/config, logging, cached state, and service clients, then drives the interactive command-line menu. The app is built around user prompts rather than HTTP requests or a server loop.
3. Core orchestration boundary
The main control layer sits above the service modules and decides which path to execute: recommendation generation, queue insertion, playlist management, or settings/cache actions. This makes the app behave like a small workflow engine coordinating API calls and local state updates.
4. Spotify integration layer
src/spotify.py is the main boundary to Spotify. It handles authentication, search, playback-related actions, playlist creation/updates, reading liked songs and library items, and adding tracks to a queue. The .spotify_cache file in data/prod persists Spotify auth tokens locally so the user usually only authorizes once.
5. Recommendation / AI pipeline
src/ai.py is the recommendation engine interface. The flow is: choose a seed track/artist/album/playlist/liked song in Spotify, enrich that seed with track attributes, send a structured prompt to Gemini, then turn the model output into song-artist recommendations. src/audio_db.py and src/genius.py appear to supply enrichment data used by the prompt.
6. External data enrichment
The app is not relying on Spotify alone. It enriches seed tracks with additional metadata from external music data sources before calling Gemini. Based on the repo and README, this includes at least Genius-related auth/data and an audio/genre attribute source such as TheAudioDB or a similar service configured through environment variables.
7. Local cache and app state
src/cache_manager.py manages persistent application state in data/prod/cache.json. This cache stores user-level configuration such as default playlist settings, limits, and other UI/stateful preferences that should survive restarts.
8. Database subsystem
src/database/db.py, src/database/factory.py, and src/database/track_attributes.py form a separate persistence/import subsystem centered on a local SQLite database. The repo includes data/songs.db as generated storage, and the README shows CLI commands for importing artists and seeding the database. This subsystem is distinct from the lightweight JSON cache.
9. Configuration and secrets
src/env.py loads environment variables for Spotify, Gemini, Genius, and other external providers. This is where API credentials and redirect URIs are expected to come from, so the app’s external dependencies are configured entirely at the edge rather than hardcoded.
10. CLI user flows
The user-facing flows are:
- pick a discovery source and generate recommendations,
- create a new playlist or fill an existing/default playlist,
- add recommendations to the Spotify queue,
- adjust settings like default playlist name, description, limits, and cache/auth resets.
The flowcharts in waitlist.mermaid and genius_auth.mermaid document these paths, though the README notes the main flowchart is outdated.
11. Data files and generated artifacts
data/prod/lyric_attributes.json looks like a generated lookup/attribute file used by the recommendation pipeline or database import. The data/prod folder is the main persistence area for runtime artifacts, while source code stays under src/.
12. Important architectural boundaries
The key boundaries to diagram are:
- CLI/orchestrator vs. service modules,
- service modules vs. external APIs,
- transient config/cache vs. durable SQLite database,
- Spotify auth/session state vs. application preferences.
Most of the repo’s behavior is shaped by these boundaries and the data moving between them.
Main entry points: main.py Main · ai.py Recommender · env.py Env · db.py SQLite DB
Components 17
CLI orchestration
Interactive command-line flows and top-level control.
- Main · Top-level entry point that initializes config, logging, state, and drives interactive flows.
src/main.py - Env · Loads environment variables and secrets for external providers.
src/env.py - Logger · Configures application logging.
src/logger_config.py - Utils · Common utility functions used across the CLI and services.
src/utils.py
Service layer
Spotify, recommendation, and enrichment modules.
- Spotify · Primary boundary for Spotify auth, search, playback, playlists, library reads, and queueing.
src/spotify.py - Recommender · Builds prompts from seed music and turns model output into recommendations.
src/ai.py - Audio DB · Supplies track attributes and metadata used to enrich recommendation seeds.
src/audio_db.py - Genius · Provides Genius-related auth or metadata for enrichment workflows.
src/genius.py - Genius Auth · Interactive Genius authorization flow documented as a separate path.
src/genius_auth.py
Persistence
Local cache, SQLite database, and generated runtime artifacts.
- Cache · Persistent app preferences and lightweight runtime state in a local JSON cache.
src/cache_manager.py - DB Factory · Creates or wires the local SQLite database connection.
src/database/factory.py - SQLite DB · Local durable database used for imported track and artist data.
src/database/db.py - Track Attrs · Database-side track attribute schema and import logic.
src/database/track_attributes.py - Lyric Data · Generated JSON lookup data used by enrichment or import workflows.
data/prod/lyric_attributes.json
External APIs
Third-party services the app talks to directly.
- Spotify API · Third-party Spotify platform used for user authentication and music actions.
- Gemini API · Third-party model service used to generate recommendations.
- Genius API · Third-party lyrics and music metadata service.
Connections 23
- Main → Env: loads · Reads configuration and secrets before starting the menu loop.
- Main → Logger: configures · Initializes logging early in startup.
- Main → Cache: hydrates · Loads persisted app preferences and runtime state.
- Main → Spotify: drives · Routes menu actions into Spotify operations.
- Main → Recommender: calls · Triggers recommendation generation workflows.
- Main → DB Factory: initializes · Bootstraps the SQLite-backed database subsystem when needed.
- Main → Utils: uses · Shares common helper behavior across flows.
- Spotify → Spotify API: auths with · Talks directly to Spotify for auth and user/music actions.
- Recommender → Spotify: seeds from · Pulls selected tracks, artists, albums, playlists, or liked songs as recommendation seeds.
- Recommender → Audio DB: enriches with · Adds track attributes and metadata before prompting the model.
- Recommender → Genius: enriches with · Uses Genius-derived information as part of seed enrichment.
- Recommender → Gemini API: prompts · Sends structured prompts to Gemini and parses the output.
- Audio DB → SQLite DB: imports to · Supports persisting enriched metadata into the local database.
- DB Factory → SQLite DB: creates · Builds or connects to the SQLite database.
- SQLite DB → Track Attrs: stores · Holds imported track attribute records and related entities.
- SQLite DB → Lyric Data: references · Consumes generated attribute data during import or lookup workflows.
- Genius → Genius API: auths with · Communicates with Genius for metadata and authorization.
- Genius Auth → Genius API: authorizes · Documents the standalone Genius authorization flow.
- Cache → Spotify: persists session · Stores local Spotify auth/session state separately from app preferences.
- Cache → Main: restores prefs · Feeds saved defaults and limits back into the interactive flows.
- Env → Spotify API: credentials · Supplies Spotify client settings and redirect configuration.
- Env → Gemini API: credentials · Supplies model API keys and configuration.
- Env → Genius API: credentials · Supplies Genius API settings and secrets.