[PR #928] feat: add 'open' CLI command for playing Spotify URIs/URLs #1866

Open
opened 2026-03-14 15:37:12 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/aome510/spotify-player/pull/928
Author: @greqor
Created: 2/12/2026
Status: 🔄 Open

Base: masterHead: feat/open-uri-url


📝 Commits (2)

  • 8d5c104 feat: add 'open' CLI command for playing Spotify URIs/URLs
  • a9936b5 fix: inline format args for clippy

📊 Changes

5 files changed (+113 additions, -29 deletions)

View changed files

📝 README.md (+1 -0)
📝 spotify_player/src/cli/client.rs (+95 -29)
📝 spotify_player/src/cli/commands.rs (+8 -0)
📝 spotify_player/src/cli/handlers.rs (+7 -0)
📝 spotify_player/src/cli/mod.rs (+2 -0)

📄 Description

Resolves #887

What

Adds a new spotify_player open <URI_OR_URL> CLI command that starts playback of a Spotify item directly from the command line.

Both Spotify URIs and web URLs are accepted:

# By URI
spotify_player open spotify:track:6rqhFgbbKwnb9MLmUQDhG6

# By URL
spotify_player open https://open.spotify.com/track/6rqhFgbbKwnb9MLmUQDhG6

Supported item types: tracks, albums, artists, playlists.

How it works

  • URLs are converted to URIs by parsing the path segments (/track/IDspotify:track:ID).
  • The URI is matched against TrackId, AlbumId, ArtistId, and PlaylistId parsers to build the appropriate PlayerRequest::StartPlayback.
  • Execution follows the same dual-mode pattern as the existing playback command - async when a TUI instance is running, synchronous otherwise.

Refactoring

The async/sync player request logic that was previously inlined in handle_playback_request has been extracted into a shared execute_player_request() helper. Both playback and open commands now delegate to it, removing duplication.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/aome510/spotify-player/pull/928 **Author:** [@greqor](https://github.com/greqor) **Created:** 2/12/2026 **Status:** 🔄 Open **Base:** `master` ← **Head:** `feat/open-uri-url` --- ### 📝 Commits (2) - [`8d5c104`](https://github.com/aome510/spotify-player/commit/8d5c1041d2e69dbbad0088c58149f550bffb12e8) feat: add 'open' CLI command for playing Spotify URIs/URLs - [`a9936b5`](https://github.com/aome510/spotify-player/commit/a9936b595ba02cad7bab33cf5f9512c2b265a36b) fix: inline format args for clippy ### 📊 Changes **5 files changed** (+113 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+1 -0) 📝 `spotify_player/src/cli/client.rs` (+95 -29) 📝 `spotify_player/src/cli/commands.rs` (+8 -0) 📝 `spotify_player/src/cli/handlers.rs` (+7 -0) 📝 `spotify_player/src/cli/mod.rs` (+2 -0) </details> ### 📄 Description Resolves #887 ### What Adds a new `spotify_player open <URI_OR_URL>` CLI command that starts playback of a Spotify item directly from the command line. Both Spotify URIs and web URLs are accepted: ```sh # By URI spotify_player open spotify:track:6rqhFgbbKwnb9MLmUQDhG6 # By URL spotify_player open https://open.spotify.com/track/6rqhFgbbKwnb9MLmUQDhG6 ``` Supported item types: **tracks**, **albums**, **artists**, **playlists**. ### How it works - URLs are converted to URIs by parsing the path segments (`/track/ID` → `spotify:track:ID`). - The URI is matched against `TrackId`, `AlbumId`, `ArtistId`, and `PlaylistId` parsers to build the appropriate `PlayerRequest::StartPlayback`. - Execution follows the same dual-mode pattern as the existing `playback` command - async when a TUI instance is running, synchronous otherwise. ### Refactoring The async/sync player request logic that was previously inlined in `handle_playback_request` has been extracted into a shared `execute_player_request()` helper. Both `playback` and `open` commands now delegate to it, removing duplication. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-player#1866
No description provided.