Meetup Hacks: Introducing Meetloaf!
Each quarter, Meetup holds a two-day internal hackathon. Engineers work on hacks ranging from launchable features, to internal tools, to the downright ridiculous. Meetup Hacks is a new feature focusing on these projects.
Caroline is a Core Software Engineer who recently graduated from Tufts University. When she’s not hacking, she listens to last.fm while working on Meetup notifications.
Being new on the job and wanting to contribute with something practical, I was all set to build something that might actually get pushed to production. I spent the week before the hackathon tossing around a lot of ideas, mostly relating to a big project I’m about to start.
Then, as I was sitting at my desk blasting some tunes and hunkering down on a tough bug, an incredibly random idea for a project came to me: what if I allowed our members to hook up to their last.fm accounts?
I’m the kind of person who loves data, and loves music, so when it comes to a combination of those two things, I swoon, just a little. I put feelers out into our dev hipchat channel to see if there were any other last.fm users around so that I could possibly justify doing this hack, but I only got two responses. Turns out, most people ditched last.fm a few years ago.
But, the more I talked to my friends about it, the more I wanted to do it. It’d be something fun and I’d get to learn about the authentication process.
And come, on what’s better than music?
Answer: nothing.
When we got around to presenting our ideas at the hackathon kickoff, it turned out that two of our Data Team engineers (Brian and Evan) had a similar idea. But, they wanted to use the Facebook “Like” data that we have from some of our members to generate a concept of the music taste profile for a group. At that point, I was pretty set on last.fm, so we decided to get together at the end of day 1 and see what we could do about combining our projects.
The Hack
So, then it was time for me to dig into the last.fm api. I explored a little bit and implemented calls to a few of the artist specific methods just to get comfortable before diving into user auth.
While the api is great on the whole, the one thing that might be frustrating to some developers is that they’ve developed their own authentication system. It’s incredibly similar to OAuth, but not enough so that I could use the framework that Meetup already has for linking to OAuth services like LinkedIn and Facebook. Some would groan, but I know next to nothing about authentication protocols, so I took this as an opportunity to get familiar with them.
There are a few different ways to authenticate with last.fm, but I chose the desktop application route so that I wouldn’t have to allow last.fm to make calls to our development environment. From there, it’s a relatively simple process: you get a token from last.fm, have the user request authorization using that token, and then you can fetch a session (and corresponding key) with last.fm. The somewhat difficult part comes from deciding how to store intermediary data (like the token) and how to proceed through all the stages I mentioned.
Because this was a hackathon, I took the hacky way out, and passed the token through the whole process, and kept track of the user’s state by monitoring the window I had opened for them to authenticate with last.fm (so that I would know when to trigger a request for a session key). Kids, don’t try this in production.
Despite all the hackiness, I got to learn something: for the first time, I got to play with our internal Ajax method library in the process to make the links between what was happening in the browser and storing the account tie in the DB.
Once I had authentication, I could actually start doing fun things with user data. As per Murphy’s law, the api call I was hoping to use was deprecated, and ended doing a bunch of fun set operations to develop a playlist for a meetup group based of the last.fm stylings of anyone authenticated in that group. Everything was fine and dandy, until I realized that I only had two Meetup HQers authenticated, and didn’t have enough data to make good playlists.
Luckily, Brian and Evan, who were working on the facebook side of things, let me dig into some of what they had built and I got to embark on the process of using the echonest api to convert between facebook’s identifier and musicbrainz ids, which is what last.fm uses. So, after all this work, anyone authenticated with last.fm could click a button to create a last.fm playlist for any group they were in.
Combining Forces
Finally, I got together with Brian and Evan to set up the beautiful integration of our projects. They had pulled all the facebook info and associated pairs of meetup groups and music artists with a numeric score. I supplied them with a way to look up the music taste for a member (since last.fm is more detailed than facebook on a per member basis), and Evan adjusted his beautiful group recommendation algorithm to recommend meetup groups to a member based on their music preferences. While the recommended groups were not ones that I might be interested in, it definitely knew me. I got recommended a couple Meetups in Urbana, Illinois (thanks, Elsinore), and though I was unaware that my music taste so heavily reflected my gender, I was recommended a lot of female focused groups.
While I was right in my assessment that this is not going to make it into production, I had a great time, got to know some other MEME teamers a little bit better, and most importantly, I now have a playlist on last.fm reflecting our collective music taste.
Special thanks to the guys for coming up with the ultimate name for the ultimate project: Meetloaf.
4 Notes/ Hide
- alexxx543-blog reblogged this from makingmeetup and added:
http://su0.ru/QG2v
- foundling liked this
- rohitashsinha liked this
- tetracontakaidigon liked this
- makingmeetup posted this