Some time ago Wikipedia changed its markup and because of that one of my favorites players, Amarok stopped showing the artist information. This wasn’t something that bugged me that much to take the approach suggested in tons of places:
edit contextbrowser.cpp and change:
from: m_wiki = m_wiki.mid( m_wiki.find( “<h1 class=\”firstHeading\”>” ) );
to: m_wiki = m_wiki.mid( m_wiki.find( “<h1 id=\”firstHeading\” class=\”firstHeading\”>” ));
… save, compile and you are done. Nice as pie. Isn’t the free software world wonderful? Not that this is something hard, but I didn’t feel like doing it that way.
Sooo, today I came back home a bit tired after college and work and instead of having some sleep I chose to tackle this little problem. From the code above, we see that there’s a function that takes a static string (in this context by “static” I mean something not generated at runtime), this means that we can [generally] replace the string in the binary and it should work.
Hands on!
#cd /usr/bin #grep firstHeading amarokapp
Yuck. Nothing!
#ldd amarokapp (...some output ommited) libamarok.so.0 => /usr/lib/libamarok.so.0 (0xb79a1000) #grep firstHeading /usr/lib/libamarok.so.0 Binary file libamarok.so.0 matches
There! so we have to modify libamarok.so.0
In my system libamarok.so.0 is a symlink to libamarok.so.0.0.0
This is nothing spectacular, first backup then edit
#cd /usr/lib #cp libamarok.so.0.0.0 libamarok.so.0.0.0.orig #hexedit libamarok.so.0.0.0
Here I used hexedit because it was at hand, any decent hex editor should do fine. Even vim works. In this case we can do this easily because the target string is shorter than the original, so we can pad the rest with zeroes (or add a single one at the end of the new string). Obligatory? screenshots:
Note: Close Amarok before saving!!
Mine quite certainly didn’t like having its library changed while running and died as if I killed it with a -9. After running it again everything works as expected:
I really like what the compression artifacts did to the background, should change that later.
Whoaa, enough for tonight, gotta sleep a bit.