Saturday, November 20, 2010

Scrobbling now from Kobol :)

In case you know about scrobbling and wondering what the hell is Kobol, well its a app that I created over the last weekend and named it such 'coz it just has such a nice ring to it. :) In case you are not familiar with BSG, its a planet in BSG world, so its something like saying 'scrobbling now from Krypton/Moon etc' :)

Its a rare thing for the lazy me to go create stuff like this, mainly 'coz -
  1. I'm lazy
  2. It should excite me a lot or should be a really very serious itch to overcome 1.
Last time it happened was while scratching my support for pidgin itch. In this case, it wasn't exactly my itch but rather my friend's itch that began it all.

Now my friend is what you call as a 'purist' and considers me as some sort of expert(mainly 'coz I introduced it to him I think). And so a month or two back he asks me -
'Playing your own library is fine but the songs get repetitive after a while, so how do I get to play more songs from the same artists and not any others'.
If you are not a subscriber, then you would know that there is very limited radios that you can listen to. You can listen to your library radio or similar artists radio etc but there is no way you can just listen to a selected artist radio i.e songs from only that artist and not from any other. And since my purist friend didn't want to corrupt his library by listening to other radios, I suggested to use we7 or spotify which have scrobbling integrated. But they turned out to be UK only services, some consolation win for us UK folks denied of Pandora! :)

Well anyway it was then that the evil idea stuck me, 'All you need to get songs in your library is to just scrobble them and to scrobble all you need is artist and track name, so effectively all you need is a program that scrobbles from such a file'. Sadly my friend didn't want to code and so I forgot all about it, as it wasn't my itch after all!

Which made me revisit that idea. One of the unpleasant tasks involved in the above idea is in creating the actual tracks file, where to get the data, who will copy paste etc. But then I saw Google Refine videos and I was like 'wow'! And I thought with the freebase integration it just takes matter of few clicks to create the artist-tracks file you want! Since I wanted to try out Google Refine, thought why not go ahead and implement that program after all, that way I too can get new artists that I wanted to listen to into my library ;) And while I was at it thought why not learn some basic python as well and thats how it started!

Soon after I started, I hit limitations in freebase, for one thing the artist names in Freebase weren't a perfect match with ones in Also I couldn't figure out a way to get albums by an artist and tracks in that album, which was what had excited me in first place. Maybe I just needed to dig into the refine documentation a bit more but I was already bored.

So I just created a script that fetches the top tracks of a given artist from and writes to a csv. And you feed this csv to the other script which scrobbles the tracks in the csv. Now if anyone can find a good way to fetch the albums of an artist as well and the tracks in that album that will be brilliant!

If you are interested in scrobbling from a file, to listen to new artists or just to increase your scrobble count, then you can get the scripts here and . Only thing you need to do is obtain your own unique API_KEY and API_SECRET values from and replace the sample values in the script.

Since its from Kobol, this post has to end with

'so say we all'

Tuesday, September 21, 2010

Importance of being (Computer)Earnest

Now its been more than 2yrs since i posted something on this blog and sometime since i blogged, so to say I've forgotten how to write may not be too much off the mark, not that I knew how to write/blog in first place! :)

Well the ground-moving event that made me blog is something that happened today, that made me thankful for the first time for being a slightly knowledgeable person about computers. :)
The ubiquitous net decided to make a rare disappearing act today morning. And I had somehow associated such things to happen only in Third World countries, where I had lived all my life and to find such a thing happening in the First World was very surprising indeed! It got more surprising when i saw that Skype alone seemed to work, when all else was failing. That led me to conclude the problem was with BT's DNS servers. After the quick diagnosis, i knew i could vpn and use company's DNS servers and get connected to the net. So i get the vpn ip address from colleague via 'Skype - The Life Savior!' but for some reason my ipsec vpn decides to stop working then! :( So there i was still without connection to net.

Then /me thinks, this is 1st world after all, BT customer care should resolve this soon enough, so I get google IP from colleague, search for the BT customer support number and give them a call. And then i go through the longest call I've ever been put on hold - a record 30mins! even ICICIBank never did that to me back home! Well anyways as expected the call didn't yield much results, i was told many others are also seeing the same problem and it would be resolved in 24Hrs!

So i was back to square one. Then i ping another colleague, get the DNS server's ip directly, which i put in resolv.conf and lo internet works again! Its a wonderful feeling when you know only you have the net working when others don't just because you happen to have slightly more computer knowledge than the normal people. My Doctor hubby was suitably impressed when he couldn't connect to net from his laptop, when i could from mine. :D

Anyways that led me to start wondering why we don't have a on-disk DNS cache. I know its a very remote chance of my kind of scenario happening, plus it doesn't make any sense for mobile users, where the nearest DNS keeps changing. But for a home-desktop user wouldn't this make sense? Imagine if there was some option to cache the most used DNS entries, I wouldn't even have noticed that net was down. And by the way thats what happened with my iPhone, where i could access gmail, facebook everything, as it was using the cached DNS resolutions to connect.
So thats about it, until another such ground-moving event happens,