← back

spoti-cli | Terminal Spotify Client

2020COVID / Senior Year

Terminal Spotify client with vim keybindings. AppleScript/D-Bus control, lyrics via Genius, and queue management.

The Problem

Spotify's desktop app is fine but requires mouse navigation. During COVID, I wanted a terminal-based solution for music control without leaving my development environment. The existing Spotify terminal clients were either abandonware or required DBus permissions that didn't work on macOS.

Technical Approach

Built a TUI using Python's blessed library with vim-style keybindings:

- j/k: navigate up/down

- h/l: navigate left/right (playlists, albums, tracks)

- space: play/pause

- H/L: previous/next track

- Queue management with dedicated keybindings

- Lyrics fetching via Genius API

Playback control communicates with the Spotify desktop app via AppleScript (macOS) or D-Bus (Linux). This avoids authentication complexity since the desktop app handles credentials.

Interesting Challenges

AppleScript integration on macOS was brittle. The Spotify COM interface changes between versions. I added error handling and retry logic for common failure modes.

Genius's API doesn't always have lyrics available. The fallback to "lyrics not found" was a better user experience than failing silently.

What I'd Do Differently

This was a COVID senior year project. The architecture is fine for what it does, but modern alternatives (Spotify's Web API with OAuth) would be more cross-platform. The AppleScript dependency limits the project to macOS effectively.

Key Features

  • -Vim keybindings for navigation (j/k/h/l)
  • -Full playback control
  • -Lyrics display via Genius API
  • -Playlist and liked songs browsing
  • -Queue management
  • -Cross-platform (macOS + Linux)

Tech Stack

PythonFlaskblessed (TUI)Spotify APIGenius APIAppleScript/D-Bus