HendrikPetertje / vimify

Spotify integration for vim
100 stars 11 forks source link

Playlists #8

Closed benwoodward closed 4 years ago

benwoodward commented 4 years ago

This PR adds Playlist functionality.

To achieve this I had to switch the auth strategy from "Client Credentials" to "Authorization Code". This auth strategy generates tokens that allow the user to access their own private data via the API, including their private playlists.

In practical terms this means that the user needs to generate a refresh token as part of the initial setup, however, I've also created a CLI utility to easily generate these.

I think I've probably added some unnecessary duplication to the code, but for now just getting it working is all I have time for.

EDIT: Next step is to make it possible to autoplay specific tracks depending on what I'm doing in Vim. i.e.

autocmd BufNewFile,BufRead *.js :SpPlayPlaylist techno autocmd BufNewFile,BufRead *.py :SpPlayPlaylist Monty Python autocmd BufNewFile,BufRead *.rb :SpPlayPlaylist Avant-garde Jazz autocmd BufNewFile,BufRead *.swift :SpPlayPlaylist Wagner

HendrikPetertje commented 4 years ago

Sper late response, sorry about that. I'm not going to integrate this.

It feels a bit too much to have spotify execute Python which in its turn executes javascript modules. Feel free to spin this off to your own fork if you want. I might integrate playlist support over the course of the summer but will do so while staying in the scope of python and as far away as possible from having to open browsers to "OAUTH" users instead of just using the basicAuth option spotify gives to developers for this.

Looks really cool though ;)

benwoodward commented 4 years ago

No worries, it was a fun learning challenge either way.