spotify-cli-mac
spotify-cli-mac copied to clipboard
play music direcly from terminal
Was thinking about using an terminal media player so there no use in opening in fact Spotify, so the cli could actually work as thr spottify app instead of just controling it. This is a issue I would like to resolve! Any ideias? :D
That's an interesting idea. I am not sure how we could implement such functionality though. A potential implementation could be like this:
1 - Introduce a "player" process, that needs to be a background process which plays the audio and is also available to receive control instructions (play/pause/mute etc...) from the CLI. So player process needs some form of interprocess communication capabilities.
2 - Currently, there is Web Playback SDK which lets you play Spotify tracks within the context of a browser. Hypothetically, this could be wrapped in a headless Electron process and function as outlined in step 1. https://developer.spotify.com/documentation/web-playback-sdk/quick-start/#listening-through-the-sdk
I would like to update the CLI at some point to drop the reliance on AppleScript and make it cross-platform but I don't have time for it currently. Will leave this issue open for now.
I've found a similar use using libspotify, but didn't have the time to really get how it's done (and if it's the same thing i wanted to do) Anyway, in university recess I will take a look into it and get back to you with news
I've not come across that library, do let me know if you get some time to look into this.
I think a good first step would be to get rid of Applescript dependency and talk to API to control player state directly. Happy to help if you need any guidance/direction.
Thanks for your time @tatiana-scda
Unfortunately, libspotify is very much deprecated and no longer supported by Spotify. They suggest the Web Playback SDK as an alternative. An Electron app using that SDK would be the best bet to get something "standalone" playing audio.