Wednesday, 3 September 2014

GSoC Completed

Many times in the last three months I wondered whether I would be able to post something with such a title. But I am finally so glad to do so. Relived also.

In my remaining work I had to fetch lyrics automatically from Web APIs. I couldn't find documentation for this online. The best I could do was use Lrc-ShowX's code. I wondered how hard could that be

The thing I considered to be the easiest, turned out to be the most hellish. It was just suppose to be porting python code to Java script, which I did, keyword for keyword; learning both the languages in the process. But I wasn't getting the expected results. Now debugging. Sigh! It took me a week of intensive debugging only to realize that JavaScript is incapable of the large bitwise operations that I was doing. Python, on the other hand, has no limit on the size of its integer. Its not worth one week of intensive coding and debugging only to learn that JavaScript's largest integer is not large enough.

But actually, I learnt more than that. I leant persistence, that some problems are smaller than they seem and probably many more things than I can consciously remember.

Once the problem was identified, I quickly found a workaround. I made a C++ function that performed the calculation and returned the result. It is actually very hacky since in Amarok we have scripts (in JavaScript) that manage lyrics- decoupled from the rest of the Qt/C++ code. The function I made is useful only to the ttplayer lyrics script. Though I wasn't proud of this bit of code, it had to be done and I had to move on. I had crossed a hurdle but the marathon still had to be completed.

From there on it was mostly uneventful. I just used the existing Amarok script (that fetched plain text lyrics), except for the fetching part. I sent the results back through the same Amarok scripting API. My code was already there to handle the rest. It was working before the mid term. But even then it was very satisfying to see everything working in harmony.

Also, I just added a draft to update Amarok 's wiki page so that it reflected the feature I have added.

I had completed my GSoC project not only officially but also by my standards. It was a real proud moment. Some days later, after I submitted my code for review, there was another: