How-tos

SOmusic = music + social networks + Bluemix

Share this post:

This post is an introduction to a pet project I’m working on from time to time – it runs on Bluemix and it’s cool 🙂 If you can’t wait to read the article, you can try the SOmusic app.

A bit of background

Back in 2000s after Apple came out with the iPod, we started to have a lot of music in the palm of our hand, ripped from our CDs, bought from online MP3/AAC stores—or don’t lie to ourselves, downloaded from the Internet. With mobile devices and the low cost of storage like SD cards, our smartphones replaced iPod-like devices. During this (r)evolution, music consumption changed too. Companies like Spotify, Deezer, Beats Music, and TIDAL now offer, for a price, a large music streaming catalog. An infinitely larger number of tracks than you could fit in the largest iPod available today.

SOmusic scans social networks and tells me what people are listening to. If it is popular it might be good—or not.

Social networking is another trend that has changed how we consume information. You find an interesting video/image/article/meme, you share it on Twitter with some hashtags, your followers notice, retweet, favorite, others find this content too and that’s it, the topic is trending, the site with the article goes down—it got slashdotted as they said in the past.

Back to music; there was a time when you would tell your friends face-to-face or over the phone or by email about this new band you heard on the radio. Today, you can still do that of course, but in addition and instead of sharing this with your immediate circles, you can share on your social network—and if you were actually listening to the song on your streaming you can usually just share a link to this song to Twitter, Facebook and others. This is where SOmusic comes in, with a mission: Scan social networks and tell me what people are listening to. If it is popular it might be good—or not.

Enough said, let’s get in the gory details of how this thing is built! That’s probably the main reason you came here anyway.

Tools of the trade

The first version of SOmusic was built in a day, the result of a rainy, boring day where nothing was going in the right direction (it happens).

Having developed with Java for years (both for work and on the side here and here), I decided to build the app as a Liberty webapp – although I was tempted by Ruby on Rails (having some experience with it on another music related project). And so I started with Eclipse for the Java development,  the nicely built Bluemix plug-ins, Textmate for the webpage/javascript/css, Chrome, and of course the command line!

High level architecture

SOmusic architecture

  • collect queries the IBM Insights for Twitter service, looking for references to music links. It stores the resulting tweets into a IBM Cloudant database. In its current implementation, SOmusic searches for Spotify links – yes, I’m a premium subscriber to Spotify.
  • identify processes this database and resolves music links into song title, artist name, album title and album cover. It uses the Spotify Web API.
  • statistics aggregates data by day.
  • ranking makes the aggregated data available to the front-end in JSON.

Components collect/identify/statistics are triggered every once in a while and do not know about each other— the goal here is to be able to deploy them in multiple apps so to be scale à la microservices (although I’ve not deployed them that way yet). The triggering is done by a Quartz scheduler, embedded in the Liberty webapp; it does the job.

With no surprise, the front-end used Bootstrap, jQuery and a few plugins (Masonry, handlebars, Moment.js, jQuery Hotkeys). Masonry is responsible for the Pinterest-like layout and resize flow. Bootstrap makes the UI responsive to window size changes and smaller devices (or larger devices I should say as Bootstrap now defaults to mobile).

I’ll stop there for today. Obviously there are other aspects I’d like to share about how powerful it is to have access to historical and enriched Twitter data, how great it is that you can develop locally, and then push to GIT in Bluemix DevOps, have a build triggered and your app automatically redeployed. And also what type of improvements I’d like to put SOmusic (like country specific ranking, or SOmovies, SOtvshows, SObooks, SOso, etc). But I’ll save that for another post.

Add Comment
No Comments

Leave a Reply

Your email address will not be published.Required fields are marked *

More How-tos Stories

Kubernetes Log Forwarding with Syslog

Logs help you troubleshoot issues with your clusters and apps. Sometimes, you might want to send logs somewhere for processing or long-term storage. On a Kubernetes cluster in the IBM Cloud Container Service, you can enable log forwarding for your cluster and choose where your logs are forwarded.

Continue reading

Keeping up-to-date with Kubernetes

Kubernetes development and adoption continues to grow at a rapid pace, and keeping current can be difficult without the right process and tools. For example, IBM Cloud Container Service launched with support for Kubernetes v1.5.6 earlier this year. Since that initial launch, the Kubernetes community provided 3 minor releases (v1.6, v1.7, and v1.8) and over 25 patch releases. By year's end there's likely to be another minor release and numerous patches. So with all this change, what's the best way to keep your cluster and apps up-to-date and secure?

Continue reading

Setting Access Control Policies for IBM Cloud Object Storage

As your organization explores more digital initiatives, including cloud and mobile, the importance of identity and access management (IAM) is paramount. Nearly all IT decision makers we talk with agree that IAM is essential to the success of their company’s cloud adoption and it is seen as a key enabler for mobility, analytics and IoT initiatives.

Continue reading