mirror of
https://github.com/aome510/spotify-player.git
synced 2026-04-26 17:35:50 +03:00
[GH-ISSUE #279] Support handling CLI commands without a running spotify_player instance #1080
Labels
No labels
bug
documentation
enhancement
good first issue
help wanted
pull-request
question
third-party
third-party
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotify-player#1080
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @chrisgrieser on GitHub (Oct 28, 2023).
Original GitHub issue: https://github.com/aome510/spotify-player/issues/279
Is your feature request related to a problem? Please describe.
spotify_player playback …requires a running instance ofspotify_player. However, when playing viaSpotify Connect, you do not always really need a daemon or the TUI running, often something likespotify_player playback nextis enough.Describe the solution you'd like
A way to send playback commands to a Spotify Connect device.
spotify-tuiallows you to do this viaspt playback --next– no daemon, no running TUI, affecting the Spotify Connect Device.Describe alternatives you've considered
Running
spotifiy_playerin the background all the time, even if not needed.Additional context
Looking to replace the unmaintained
spotify-tui. Basically, this is the only feature missing that I need before being able to switch.Thanks for the cli, its UI is much better than of other players I tried.
@aome510 commented on GitHub (Oct 28, 2023):
The design for CLI support between
spotify_playerandspotify-tuiare different.spotify-tuitreats CLI as a separate application, whilespotify_playertreats CLI as a tool to interact with the main application.Because CLI is a separate application, each time
spotify-tuiwant to handle a CLI command, e.gplayer next, it will need to initialize a Spotify client from scratch, which includes fetching credentials. The credential fetching part can make handling the CLI command slow.spotify_playerCLI handles those commands instantly. Of course, this is a trade-off between flexibility and performance.Currently, the
spotify_playerCLI architecture is implemented based on the assumption that it's a tool to communicate with the main application. Will need to find a good way to abstract the codes to support both modes.@catgoose commented on GitHub (Nov 1, 2023):
I used to use
spotify_tuiin neovim with the toggle term plugin. It was simple to open a floating window to control spotify. I don't really want to have an application running, I would really like to dispatch commands to a CLI when neaded.@aome510 commented on GitHub (Nov 13, 2023):
@catgoose @chrisgrieser the support for running CLI commands without a running instance is implemented in https://github.com/aome510/spotify-player/pull/290.
Can you guys checkout
masterand run the applicationcargo run --release -- {command}to see it works as expected?Just a note that without a running instance, the latency of the command will increase significantly (~100x based in my local machine):
The bottleneck seems to come from network requests to get API token and send Spotify APIs. I will be surprised if
spotify-tuiCLI's latency is much better than this.@chrisgrieser commented on GitHub (Nov 13, 2023):
yeah,
spotify-tuialso has 1-2 seconds of latency for that. That's ok.Just checked out master the common commands (
playback next,playback play-pause) work as expected on my end :)@catgoose commented on GitHub (Nov 13, 2023):
prev, next, play-pause work for me! Could there be an argument to
volumeto increase/decrease by a percentage? My use case is to use neovim key bindings to do prev/nex/pause and lower/raise volume, so if I could adjust volume in that way it would be really nice!@aome510 commented on GitHub (Nov 13, 2023):
spotify_playersupports increasing/decreasing by an offset with--offsetoption:Decreasing just means using negative value.
@catgoose commented on GitHub (Nov 14, 2023):
I get a similar error if I try to set volume to a percentage:
@aome510 commented on GitHub (Nov 14, 2023):
weird, it works well for me (both command) to change volume of the official Spotify app. Bad request may mean that there is no active playback.