[PR #290] [MERGED] Support handling CLI commands without a running application instance #1641

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

📋 Pull Request Information

Original PR: https://github.com/aome510/spotify-player/pull/290
Author: @aome510
Created: 11/12/2023
Status: Merged
Merged: 11/13/2023
Merged by: @aome510

Base: masterHead: cli-without-running-instance


📝 Commits (6)

  • d2f0c5e handle "start liked tracks" CLI command with cache
  • dd2d1eb decouple CLI request handling codes from application's state (optional cache)
  • 597d856 move mute_state from PlayerState to SimplifiedPlayback
  • bfe296f handle CLI commands without a running application instance
  • 5bc97f6 update CLI commands README
  • 213ac1d cleanup

📊 Changes

8 files changed (+229 additions, -150 deletions)

View changed files

📝 README.md (+6 -5)
📝 spotify_player/src/cli/client.rs (+125 -78)
📝 spotify_player/src/cli/handlers.rs (+43 -10)
📝 spotify_player/src/client/mod.rs (+21 -33)
📝 spotify_player/src/main.rs (+14 -9)
📝 spotify_player/src/state/model.rs (+16 -0)
📝 spotify_player/src/state/player.rs (+2 -4)
📝 spotify_player/src/ui/playback.rs (+2 -11)

📄 Description

Resolves #279

Changes

  • initialize a new client and spawn a separate thread for handling CLI commands without a running spotify_player instance
  • update CLI client code to support handling requests without the application's state
  • move mute_state from PlayerState struct to SimplifiedPlayback struct

Benchmarks

Without a running instance

  • playback next
$ time test_spotify_player playback next
________________________________________________________
Executed in    1.15 secs      fish           external
   usr time   28.03 millis    0.23 millis   27.80 millis
   sys time   18.36 millis    1.83 millis   16.54 millis
  • get key playback
> time test_spotify_player get key playback
________________________________________________________
Executed in    1.27 secs      fish           external
   usr time   29.29 millis    0.25 millis   29.04 millis
   sys time   23.85 millis    2.13 millis   21.71 millis

With a running instance

  • playback next
> time test_spotify_player playback next
________________________________________________________
Executed in   14.94 millis    fish           external
   usr time    7.58 millis    0.19 millis    7.39 millis
   sys time    5.54 millis    1.54 millis    4.00 millis
  • get key playback
> time test_spotify_player get key playback
________________________________________________________
Executed in   16.28 millis    fish           external
   usr time    7.54 millis    0.19 millis    7.35 millis
   sys time    5.90 millis    1.63 millis    4.27 millis

🔄 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/290 **Author:** [@aome510](https://github.com/aome510) **Created:** 11/12/2023 **Status:** ✅ Merged **Merged:** 11/13/2023 **Merged by:** [@aome510](https://github.com/aome510) **Base:** `master` ← **Head:** `cli-without-running-instance` --- ### 📝 Commits (6) - [`d2f0c5e`](https://github.com/aome510/spotify-player/commit/d2f0c5e946463c6201ced04197420acad4e2543c) handle "start liked tracks" CLI command with cache - [`dd2d1eb`](https://github.com/aome510/spotify-player/commit/dd2d1ebd84da158c4d5922963e87d0e167d72f8a) decouple CLI request handling codes from application's state (optional cache) - [`597d856`](https://github.com/aome510/spotify-player/commit/597d85646a98b1de2f523b656c486ca527e50934) move `mute_state` from `PlayerState` to `SimplifiedPlayback` - [`bfe296f`](https://github.com/aome510/spotify-player/commit/bfe296f4741b923431768dc695bb72b84ec5c323) handle CLI commands without a running application instance - [`5bc97f6`](https://github.com/aome510/spotify-player/commit/5bc97f6b6e471bafcb7d6e60bcb6e936d68e2d2e) update CLI commands README - [`213ac1d`](https://github.com/aome510/spotify-player/commit/213ac1dba58b406d185bb3a0ae2578b3b2ca5c4e) cleanup ### 📊 Changes **8 files changed** (+229 additions, -150 deletions) <details> <summary>View changed files</summary> 📝 `README.md` (+6 -5) 📝 `spotify_player/src/cli/client.rs` (+125 -78) 📝 `spotify_player/src/cli/handlers.rs` (+43 -10) 📝 `spotify_player/src/client/mod.rs` (+21 -33) 📝 `spotify_player/src/main.rs` (+14 -9) 📝 `spotify_player/src/state/model.rs` (+16 -0) 📝 `spotify_player/src/state/player.rs` (+2 -4) 📝 `spotify_player/src/ui/playback.rs` (+2 -11) </details> ### 📄 Description Resolves #279 ## Changes - initialize a new client and spawn a separate thread for handling CLI commands without a running `spotify_player` instance - update CLI client code to support handling requests without the application's state - move `mute_state` from `PlayerState` struct to `SimplifiedPlayback` struct ## Benchmarks ### Without a running instance * `playback next` ``` $ time test_spotify_player playback next ________________________________________________________ Executed in 1.15 secs fish external usr time 28.03 millis 0.23 millis 27.80 millis sys time 18.36 millis 1.83 millis 16.54 millis ``` * `get key playback` ``` > time test_spotify_player get key playback ________________________________________________________ Executed in 1.27 secs fish external usr time 29.29 millis 0.25 millis 29.04 millis sys time 23.85 millis 2.13 millis 21.71 millis ``` ## With a running instance * `playback next` ``` > time test_spotify_player playback next ________________________________________________________ Executed in 14.94 millis fish external usr time 7.58 millis 0.19 millis 7.39 millis sys time 5.54 millis 1.54 millis 4.00 millis ``` * `get key playback` ``` > time test_spotify_player get key playback ________________________________________________________ Executed in 16.28 millis fish external usr time 7.54 millis 0.19 millis 7.35 millis sys time 5.90 millis 1.63 millis 4.27 millis ``` --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 15:24: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#1641
No description provided.