What I did on leave: Coding

I recently spent several months on paternity leave, and took the opportunity to do a coding project that I’d been wanting to write for a while. This was both a chance to use some free-ish time to take care of this project, as well as a way to keep my coding skills up while on leave and learn some new technologies.

The problem I solved was the following: I like to listen to my music collection randomly, by album. Previously I solved this by using Alfred’s iTunes mini-player, which has a “Play Random Album” command; since moving to Windows and moving most of my music listening to Spotify I’d been missing this functionality. To solve it, I wrote a basic web app using the Spotify API that retrieves your list of saved albums, and can select a random entry from that list and cause Spotify to play it.

The current version can be seen at https://randspotrand.anonymous-function.net. It uses the Spotify API “implicit grant” authorization option, so authorization is not long lived (an hour or two) but it can be implemented purely client-side. All the code is open-source, and can be found at https://github.com/singerb/randspotrand. The README there lists the technologies used. As a personal project, it’s entirely over-engineered; Vue can be used very simply, but since I’d never used a Flux-like store before, I wanted to integrate Vuex. I also put a bit of work into the build tooling so that I could use TypeScript everywhere, and used a nice helper library so that the Vuex store could also be typesafe. There are still some build improvements that would be nice, notably that some type-checking only happens in the IDE due to how the single-file-components are written.

Feel free to play with/use it, and file issues or PRs on GitHub if you have ideas or suggestions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s