I just discovered that iTunes 10.4 finally introduced support to load m3u files. If you are importing large quantities of mp3 archives like me then you probably will be very annoyed by the mess that iTunes 10.4 will make out of this – playlists will be created and a ugly mess will emerge (and takes longer to process). So it was time to try to remove this feature, which is curious since I always wanted this in iTunes, before I surrended myself to its way of managing mp3s. A quick google search shows that I am not the only one having “issues” with this new feature 🙂
First attempt was to disassemble and search for the code. Well, iTunes is a huge program and I just wanted a quick hack (I did find more or less where the interesting code is). So why not searching for the string m3u and modify it? Most probably iTunes was processing the files based on extension and modifying that string would effectively remove this feature.
A quick test with GDB and voila, it works. No more m3u/m3u8 (unicode version) processing! Hurray 🙂
To make the change effective there are two solutions; first patch the binary, which would require an update to codesign, second create a small loader to patch the strings in memory, leaving the original binary intact. Second one is more fun, so here it is, a small loader for iTunes 10.4.1 that will remove this feature. For now it’s 32 bits only, which is the version that runs on Snow Leopard. I will test later with Lion.
To use this loader, execute the following commands in Terminal.app (after downloading and unpacking the loader.gz):
$ sudo cp /Applications/iTunes.app/Contents/MacOS/iTunes /Applications/iTunes.app/Contents/MacOS/iTunes.orig $ sudo cp loader /Applications/iTunes.app/Contents/MacOS/iTunes $ sudo chgrp procmod /Applications/iTunes.app/Contents/MacOS/iTunes $ sudo chmod g+s /Applications/iTunes.app/Contents/MacOS/iTunes
And that’s it, you can click the usual iTunes icon. The program will start and no more m3u processing! If you check Activity Monitor, you will have two iTunes processes, one with a very small memory footprint (the loader), and the real iTunes. When you exit iTunes the loader will also exit, so everything is nice & clean.
I might improve this loader to be smart and support any new iTunes updates, and maybe create a Cocoa application to launch iTunes with this m3u enabled or disabled. I need a small excuse to start coding Cocoa apps 😉
Here it is a version that should work with all future iTunes updates and also for Lion with ASLR support (ASLR isn’t disabled by the loader!). Install as in the previous version.