[PR #159] [MERGED] Implement spotify-player's CLI commands #1584

Closed
opened 2026-03-14 15:21:54 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/aome510/spotify-player/pull/159
Author: @aome510
Created: 3/18/2023
Status: Merged
Merged: 4/26/2023
Merged by: @aome510

Base: masterHead: implement-app-api


📝 Commits (10+)

  • 5b8b0c0 implement a simple "get playback" cli command
  • d7b0437 implement get commands for several keys
  • 80a2106 add and parse some playback commands
  • b991dd2 handle pause,next,shuffle,repeat commands
  • 0fa1cd2 refactor cli codes and
  • 602641d refactor get command handler codes using clap::ValueEnum
  • 17189c8 add UserSavedAlbums and UserFollowedArtists to the supported keys
  • 6b9746d add basic handler for playback play command
  • e42afe9 implement get context command
  • b88f1cd allow volume to be 100

📊 Changes

10 files changed (+765 additions, -199 deletions)

View changed files

📝 Cargo.lock (+243 -144)
📝 spotify_player/Cargo.toml (+1 -1)
spotify_player/src/cli/commands.rs (+67 -0)
spotify_player/src/cli/handlers.rs (+102 -0)
spotify_player/src/cli/mod.rs (+52 -0)
spotify_player/src/cli/socket.rs (+218 -0)
📝 spotify_player/src/client/mod.rs (+5 -5)
📝 spotify_player/src/config/mod.rs (+4 -0)
📝 spotify_player/src/main.rs (+65 -44)
📝 spotify_player/src/state/model.rs (+8 -5)

📄 Description

Resolves #111.
Partially #103.

Changes

Added CLI commands and subcommands

  • get:
Get spotify data

Usage: spotify_player get <COMMAND>

Commands:
  key      Get data by key
  context  Get context data
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help
  • get key:
Get data by key

Usage: spotify_player get key <key>

Arguments:
  <key>  [possible values: playback, devices, user-playlists, user-liked-tracks, user-saved-albums, user-followed-artists, user-top-tracks, queue]

Options:
  -h, --help  Print help
  • get context
Get context data

Usage: spotify_player get context <context_type> <context_id>

Arguments:
  <context_type>  [possible values: playlist, album, artist]
  <context_id>

Options:
  -h, --help  Print help
  • playback
Interact with the playback

Usage: spotify_player playback <COMMAND>

Commands:
  play      Start a playback
  resume    Resume the playback
  pause     Pause the playback
  next      Next track
  previous  Previous track
  shuffle   Toggle the shuffle mode
  repeat    Cycle the repeat mode
  volume    Set playback's volume percentage
  seek      Seek the playback by an offset
  help      Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help

🔄 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/159 **Author:** [@aome510](https://github.com/aome510) **Created:** 3/18/2023 **Status:** ✅ Merged **Merged:** 4/26/2023 **Merged by:** [@aome510](https://github.com/aome510) **Base:** `master` ← **Head:** `implement-app-api` --- ### 📝 Commits (10+) - [`5b8b0c0`](https://github.com/aome510/spotify-player/commit/5b8b0c02b34915242fefea10f11284439b89f674) implement a simple "get playback" cli command - [`d7b0437`](https://github.com/aome510/spotify-player/commit/d7b04374f2e6efe0791c881f017947aab908895d) implement get commands for several keys - [`80a2106`](https://github.com/aome510/spotify-player/commit/80a2106833f5b48f909879af032f24575d39cc35) add and parse some `playback` commands - [`b991dd2`](https://github.com/aome510/spotify-player/commit/b991dd255e13a704f31c6fada20bf64a68c9bfa6) handle pause,next,shuffle,repeat commands - [`0fa1cd2`](https://github.com/aome510/spotify-player/commit/0fa1cd2559648c9d78dc65bc56a60a8931bbb81a) refactor cli codes and - [`602641d`](https://github.com/aome510/spotify-player/commit/602641d2d96178ea2ca4224c66e0b274af70986c) refactor `get` command handler codes using `clap::ValueEnum` - [`17189c8`](https://github.com/aome510/spotify-player/commit/17189c8bdd359a72fec43f176e90ca17d11f6e73) add `UserSavedAlbums` and `UserFollowedArtists` to the supported keys - [`6b9746d`](https://github.com/aome510/spotify-player/commit/6b9746d41454acb275990232d8cb83521944f63d) add basic handler for playback play command - [`e42afe9`](https://github.com/aome510/spotify-player/commit/e42afe943e22a388b4cf6df2afbd234435c490f9) implement get context command - [`b88f1cd`](https://github.com/aome510/spotify-player/commit/b88f1cdd8f682b11a6bb5f847b39e6543f41ad8c) allow volume to be 100 ### 📊 Changes **10 files changed** (+765 additions, -199 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+243 -144) 📝 `spotify_player/Cargo.toml` (+1 -1) ➕ `spotify_player/src/cli/commands.rs` (+67 -0) ➕ `spotify_player/src/cli/handlers.rs` (+102 -0) ➕ `spotify_player/src/cli/mod.rs` (+52 -0) ➕ `spotify_player/src/cli/socket.rs` (+218 -0) 📝 `spotify_player/src/client/mod.rs` (+5 -5) 📝 `spotify_player/src/config/mod.rs` (+4 -0) 📝 `spotify_player/src/main.rs` (+65 -44) 📝 `spotify_player/src/state/model.rs` (+8 -5) </details> ### 📄 Description Resolves #111. Partially #103. ## Changes Added CLI commands and subcommands - `get`: ``` Get spotify data Usage: spotify_player get <COMMAND> Commands: key Get data by key context Get context data help Print this message or the help of the given subcommand(s) Options: -h, --help Print help ``` - `get key`: ``` Get data by key Usage: spotify_player get key <key> Arguments: <key> [possible values: playback, devices, user-playlists, user-liked-tracks, user-saved-albums, user-followed-artists, user-top-tracks, queue] Options: -h, --help Print help ``` - `get context` ``` Get context data Usage: spotify_player get context <context_type> <context_id> Arguments: <context_type> [possible values: playlist, album, artist] <context_id> Options: -h, --help Print help ``` - `playback` ``` Interact with the playback Usage: spotify_player playback <COMMAND> Commands: play Start a playback resume Resume the playback pause Pause the playback next Next track previous Previous track shuffle Toggle the shuffle mode repeat Cycle the repeat mode volume Set playback's volume percentage seek Seek the playback by an offset help Print this message or the help of the given subcommand(s) Options: -h, --help Print help ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 15:21:54 +03:00
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#1584
No description provided.