I'm a huge music nerd. I've played in many bands in my teens 20s, and music is a big part of my life. I'm also a big fan of Pitchfork music reviews.
![Music Music](/uploads/1/3/4/1/134132839/538155213.jpg)
There was a mashup site I was using called Pitchify, which was no longer updating, and it eventually got taken down. So I did what any engineer would do and I created my own mashup!
12inch.reviews is a mashup of Pitchfork's album reviews with Spotify's web playback SDK. It utilizes the browser's IndexedDB API to allow for fast, responsive searching and sorting of 17k+ album reviews, and allows you to play the full album right in the browser!
Apart from this, you will get extra tips on how to get Spotify music downloaded with high quality. Spotify web free premium. Let's get started with the first part: What bitrate is Spotify use?
- But one of the big new categories of apps for Spotify, Ek said, would be “editorial apps,” or apps that guide user tastes and offer recommendations. Voices from the likes of Pitchfork.
- March 16, 2015 March 16, 2015 chrisshipman API, apps, Guardian, music, Pitchfork, Spotify, technology Leave a comment Spotify Monday morning has become host to something of a ritual for me over the past couple of months – get settled into some writing, and fire up Spotify in search of the new week’s releases to soundtrack my work.
Pitchfork’s app takes the experience of reading reviews and best-of lists from the influential publication and bakes that directly into Spotify itself, enabling immediate playback of the albums.
As with any side project, I had a few learning goals in mind that I wanted to bake in:
- Continue to invest in learning React, specifically React hooks, and progressive web apps.
- Learn tailwind.css
- I wanted it to include all of Pitchfork's reviews, and have them be easily searchable. There are a lot of seminal albums that I just haven't had exposure to. Being able to find them easily would be a requirement.
- I wanted to leverage different and interesting browser technologies to keep the main functionality of this site all on the frontend.
- I wanted it to be completely open source.
Pitchfork has over 20k reviews on their site, so being able to store that many records on the frontend, specifically in Javascript, would be a challenge. Each browser has different storage quotas that aren't particularly well-documented. So I needed to think about how to work around these quotas in a seamless and transparent way.
The backend
12inch.reviews uses a simple(ish) retriever script script that does the following:
- utilizes Pitchfork's undocumented API to find new albums since the last time the script was run
- Attempts to find that album using Spotify's search API.
- If found, add that album to a simple SQLite DB
There is another backend function that will take the contents of the SQLite DB and to create a series of JSON files, which includes all the data the frontend needs. The structure of each JSON album looks like so:
Once the JSON files are created, they are uploaded to S3 for the frontend to use. Each album entry has all the info needed in order for Spotify's web SDK to use them on the frontend, and to be searchable.
The retriever Rakefile also has functions to backfill all albums (takes multiple hours!) and has some utility functions to be able to create a new SQLite DB and other functions to massage the data into the correct format.
The main task,
refresh_and_upload
runs hourly. Currently it's running as a Kubernetes CronJob on my homelab Kube cluster (I'll talk more about that in another post).Netlify Lambda functions
12inch.reviews is hosted on Netlify, mainly because Netlify is amazing. It provides a seamless CI/CD pipeline, SSL, and AWS Lambda-like functions - all for free.
I use these functions to 'log in' a user via Spotify Oauth. I would have done this all on the frontend, except for the fact that Oauth requires a secret token and that can't be exposed on the frontend.
Since Spotify's access tokens are short-lived (1 hour max!) there is also a secondary function that will renew an access token seamlessly upon playback.
Once an access token is obtained, state is stored via the browser's
LocalStorage
API.The frontend
The frontend of 12inch.reviews is a relatively simple
create-react-app
single-page app, that provides search and sort functionality, as well as the ability to play any album using Spotify's web playback SDK.Getting all the album data
When you visit 12inch.reviews the first time, it will show the albums from a small JSON file called
initial.json
. This file includes only the first 25 most recent albums, so we have something to paint on the screen.Then, the rest of the album data will be backfilled in via a series of
fetch
es to retrieve all of the JSON files. I decided to partition each JSON file with 1000 albums, so there are 17 files altogether. Each album JSON file is at least 600k uncompressed, so there is probably room for more optimization here.After each JSON file is retrieved, they are stored in an IndexedDB on the frontend. Subsequent visits to 12inch.reviews don't require the large JSON payload - it will only load the delta payloads into the DB. I'm taking advantage of the fact that these reviews are immutable - once they are written they will never change.
Pitchfork Spotify Playlist Recommends
Searching albums
Although IndexedDB is great for storing this data, there is currently no functionality to actually query IndexedDB like a regular database. So in order for 12inch.reviews to do searching and sorting, all of the data must be loaded into a simple javascript array.
Playing albums
I utilized Spotify's Web playback SDK to do the actual playing. It provides a series of hooks to use in order to initialize the player, and to do the actual playing.
I wrapped the actual playing into a simple class that ensures a refreshed access token is always provided.
Pitchfork App Spotify
The player component is one of the most complex react components in the app. Although the web playback SDK has its own state, I had to essentially 'sync up' the player component's state with the SDK's state. As with any type of synchronization, there are probably bugs keeping these 2 things in sync with each other.
The progress bar is clickable and utilizes some simple CSS animations to look and feel like a regular music progress bar.
IANA designer, but I was heavily influenced by Tesla's UX when designing the player component.
Criticism of Spotify's Web Playback SDK
My experience with Spotify's web playback SDK has been sub-par. The SDK does not have a
package.json
file, and therefore is not in the npm universe. There isn't an easy way to hook the SDK into a React or Vue app. This required a lot of manual syncing code that is probably hiding bugs.They have a public issue tracker on Github, but many of the issues don't have answered questions.
It's hard for me to understand who the target audience was for this SDK. I think it would benefit greatly from being open source and part of the NPM ecosystem. This would allow others to create wrappers for popular frameworks, which would allow me to remove my terrible syncing code.
Lessons learned + planned optimizations
This was a really fun project to work on. It took me about 6 weeks of coding, utilizing my 'side project hours' (roughly 5:30am - 7am on weekdays).
I learned a bunch of things:
Most importantly, Spotify is now free on your Android phone and tablet and play any song, artist, album, or playlist in shuffle mode. Even if you have used Spotify on your laptop to save songs and playlists. Can you play spotify free on your phone. GET SPOTIFY FREE. Play your favorites. Listen to the songs you love, and discover new music and podcasts. Playlists made easy. We'll help you make playlists. Or enjoy playlists made by music experts. Tell us what you like, and we'll recommend music for you. If you have Spotify Premium account, you just need few steps to download Spotify tracks, albums, playlists and podcast to your devices and set the Offline Mode on Spotify app. Now let’s check the. Here is what we did to play a particular song (on-demand) on Spotify using the iPhone and Android app. Download and install the Spotify app on iPhone or Android. Open Spotify and search the song that you want to play. Select a result from the Top Results, Artists or Albums section. This will take you. Fire up the Spotify app on your phone, laptop or tablet. Play a song and select Devices Available. Select your device and start listening. For more detailed instructions, visit our support page.
Spotify web player vs desktop app. Spotify is a digital music service that gives you access to millions of songs. We and our partners use cookies to personalize your experience, to show you ads based on your interests, and for measurement and analytics purposes. Spotify is a digital music service that gives you access to millions of songs. Playlist folders. If your list of playlists is long and difficult to peruse, then you need to start grouping.
- Tailwind.css
- IndexedDB
- Netlify Lambda Functions
- Spotify's APIs
12inch.reviews is a toy. It has enormous shortcomings, mainly the fact that it needs to backfill nearly 20Mb of album review data in order to work well. This is insanely inefficient and wouldn't be appropriate for anything other than a personal side project site coded for educational purposes.
Other shortcomings:
- I don't feel like I leaned into Flow types as much as I could.
- Overall performance is still not great, as measured by Chromes Dev Tools.
- I should utilize a service worker to populate the indexeddb.
- Could create a GraphQL backend to do the data serving, to alleviate the need to bring all 20MB of data to the frontend.
About InfoSuite
Spotify Info Suite is an information delivery platform for Spotify desktop application users. Our aim is to provide users with an abundance of information about the song, artist and album that they are currently listening to on the Spotify Desktop App. Info Suite will enhance aspects of the Spotify app, such as Bio and Photos, as well as create new features like Lyrics and Reviews. It will fill the information gap left by the Spotify Desktop App’s built-in features that are significantly lacking or simply don’t exist. Such features include Song Lyrics, Lyric Interpretations, Album Reviews, Facts, extended Artist Bio and unlimited Artist Photos. Our superior information will be sourced from specialized databases, aggregated reviews, and curated publications. Simple playback controls will exist on Info Suite for convenience, but the majority of music browsing, such as search, will still be handled by the Spotify Desktop App. Info Suite will always remain in sync with the desktop app, creating an integrated experience for the user.