aome510 / spotify-player

A Spotify player in the terminal with full feature parity
MIT License
3.45k stars 149 forks source link

Get Information of current playback from CLI #467

Closed vsantele closed 3 months ago

vsantele commented 3 months ago

Is your feature already implemented in the latest master? No

Is your feature request related to a problem? Please describe.

I want to use spotify_player to get information of current song played via the CLI in order to use it via a script.

Describe the solution you'd like I would like a command like spotify_player get playback or spotify_player playback info to get a json with playback information if it's available.

Additional context I try to implement this myself, I easily get a result with current_playback. But I'm not sure where is the best place to put this command.

https://github.com/aome510/spotify-player/blob/b180b6bab5f5086496e8fb83e467320218289d5e/spotify_player/src/cli/client.rs#L89-L101

jStimpert0430 commented 3 months ago

You can actually do exactly that with 'get key playback'. I use it to parse state and album information currently.

https://github.com/aome510/spotify-player/issues/294#issuecomment-1831581074

I do wish there were easier aliases however for more common things like artist/trackname.

vsantele commented 3 months ago

I didn't know this, thank you.

The documentation for cli commands doesn't explain well the get command. I will check that.

Aliases can be a good idea, but it can also be more generic and add a select parameters to specify which fields we want in return. With that we could have something like spotify_player get current that return basic info like title, artists, durations... And it's only a shortcut to something like `spotify_player get key playback --select "title,artists,duration".

aome510 commented 3 months ago

Thanks @jStimpert0430. I'll close this issue for now as spotify_player does provide a CLI command to get playback info