There’s a running joke among the squad whenever one of us has Drake show up on the gb feed. We see it as a guilty pleasure that has finally been shoved into the spotlight for the rest of squad to see. Ok it’s not that dramatic and it’s not that I don’t like Drake as an artist. However some of the squad members (xv and oc) get very defensive when we point it out, thus making the situation hilarious.
Truth be told, I have a lot of respect for Drake. He is a talented musician that has managed to cut across all boundaries and be beloved by everyone. I think my inherent aversion to something so commercially popular and the repetitive sadboi™ subject matter often puts me on guard with him; but that doesn’t mean that I haven’t listened to passionfruit on repeat—I’m a sucker for dancehall.
Enter Feed v1.0
The feed was pb‘s brain child for adding a dynamic element to gb. It presents the artists in spotify that we have been listening to for all to see. It is periodically updated to match our listening history in near real time. Spotify does not expose a streaming API nor is it necessary as the financial and technical cost on our end would be cumbersome at our current scale. Instead, we rely on spotify’s recently played tracks for the current user. This endpoint retrieves the last 50 tracks that the user has listened to for at least 30 seconds.
We are using google’s cloud platform for all of our backend components because they have a very generous free tier. The feed is simply a json file that is a map of a user to a their recent genres and artists. There is a cloud function that is being invoked every hour that simply scrapes spotify for each user’s recent tracks. It then reduces the tracks to the 5 most frequent artists and the 3 most popular genres, creates the new json file, and dumps it into a storage bucket. Although not real-time, updating the feed every hour does showcase a changing glimpse into the squad’s listening history.
The Dilemma
We all have that one artist that we keep going back to day in and day out. Their inescapable sounds provides a fix for any situation during the day. Their effect is often compounded by memories shaped during our formative years. For some, that artist is Drake. Because we were reducing the recent tracks to the most frequent artists, xv’s feed often had Drake at the forefront. This was prime fodder for the running joke that xv only listened to Drake. However, objectively speaking, xv listens to spotify more actively than the rest of squad (she listened to a whopping 235,260 minutes of spotify this year alone) with artists ranging from a wide set of genres.
Our feed was flawed in that it weighed the frequency of artists over diversity of the tracks themselves. The feed is supposed to represent a snapshot of our tastes at a given point in time. Each gb member has a heterogenous set of tastes with artists ranging from all over the world. We wanted the feed to change as our listening history changed. Our feed however ended up giving us a slightly skewed representation of our tastes.
Enter Feed v1.1
More recently, we have been thinking of aggregating our listening history into an ad-hoc spotify analytics component where we can gather interesting metrics on a user’s feed such as quantifying their genre tastes or determining how much of a sadboi™ they are. To support this and possible future endeavors, we switched to using a pubsub model to structure our feeds instead.
In order to separate concerns, we now have a different component for scraping a user
feed and generating a preview based on those fields (the feed
that you see on the site). The feeds scraped are limited to the last hour to avoid duplicating
previously seen tracks. The feed is published to a feed
topic that ultimately triggers
the preview generation function.
Moreover, this time around the feed generation simply takes the most recent artists from the current feed, prepends it to any existing artists in the feed, and takes the first 5. This effectively ensures that the most recent artist from the scrape interval will be present in the feed and finally rid us of The Drake Dilemma. To introduce more activity on our feed, we also changed the scrape interval to 30 minutes.
We give our fellow boolers a hard time for being a Drake fan girl, however we should stop and consider that maybe deep down we are all Drake fan girls as well.
He just really gets us