Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Status command to return the player status #126

Open
anomitra opened this issue Feb 26, 2020 · 7 comments · May be fixed by #127 or #166
Open

Status command to return the player status #126

anomitra opened this issue Feb 26, 2020 · 7 comments · May be fixed by #127 or #166

Comments

@anomitra
Copy link

This is pretty self-explanatory - it'd be nice if I had something like spotify status player which returns either PLAYING, PAUSED or STOPPED. Think of it as mirroring the play button's status on a music player.

The motivation behind this is that I'm using shpotify to display the player status on my terminal prompt. I'm okay with taking a stab at implementing this if the maintainers are on-board.

@hnarayanan
Copy link
Owner

Please try implementing it.

@dmofot
Copy link
Collaborator

dmofot commented Feb 27, 2020

spotify status already outputs that information (playing or paused), in addition to artist, album, track, and position. So you could pull playing or paused from the current spotify status command output. For example:

$ spotify status
Spotify is currently playing.
Artist: The White Stripes
Album: Elephant
Track: Ball And Biscuit
Position: 3:30 / 7:19

and grabbing just the part we're interested in:

$ spotify status | grep -o 'paused\|playing'
playing

As a side note, I would be careful about adding too much to the prompt only because it can slow things down if your prompt is constantly trying to pull extraneous information. There's a noticeable difference when I'm in a folder and my prompt provides the git branch info...

@anomitra anomitra linked a pull request Feb 29, 2020 that will close this issue
@anomitra
Copy link
Author

That is a possible way to go about it, but as you mentioned it would slow down the prompt considering it retrieves a lot of data that I won't really use. I added a command in #127 which is around 5x faster than doing spotify status - good enough for using in a prompt.

@dmofot
Copy link
Collaborator

dmofot commented Feb 29, 2020 via email

@anomitra
Copy link
Author

anomitra commented Mar 4, 2020

Yes, it's definitely possible for me to add that line of code to my prompt. But I still think it's a good-to-have functionality for the library. A lot of Oh-My-Zsh users (like me) use shpotify and it'd be cool if they can leverage this feature for their own prompts.

dgmstuart added a commit to dgmstuart/shpotify that referenced this issue Mar 3, 2024
dgmstuart added a commit to dgmstuart/shpotify that referenced this issue Mar 3, 2024
@dgmstuart dgmstuart linked a pull request Mar 3, 2024 that will close this issue
@dgmstuart
Copy link

dgmstuart commented Mar 3, 2024

This turned out to be extremely easy to implement!

@dgmstuart
Copy link

Oh wait - @anomitra already did it. But have a look: there's a bit of DRYing that can be done, since a number of different functions are checking the player state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants