Truncated Songs on iPod
Every so often, I’ll update the MP3 file for a given song. For instance, if I record an LP to MP3, then buy and rip the CD, I’ll just update the MP3 file on the back end and tell iTunes to reread it (with open -a itunes /path/to/file.mp3, for those who care).
Unfortunately, when I do this, I’ve noticed that iTunes plays the new file properly, while the iPod tends to hang a few seconds befor the end of the song, or, in more extreme cases, reset itself.
It seems as though the iPod caches the old file length or something: usually, the new file is longer than the old one. In these cases, the iPod hangs when it reaches the old file size, then unconfuses itself and moves on to the next song. When the new file is shorter than the old one, the iPod reaches the end of the file before it expected to, and in these cases it can panic and reset itself.
I tried playing around with various ways of forcing iTunes/iPod to update its idea of the file properly, but without success. Eventually I wound up deleting the files and reimporting them. I’d been trying to avoid that, because that way I lost things like play count, date added, as well as any playlists that the songs were in. That’s why I’d been resisting that option.
Before doing that, I created a new playlist with all the songs to be deleted and reimported. The XML file does contain all of the information I mentioned above, so if I’m feeling brave, I’ll learn enough AppleTalk to re-add all that information.
RTFS for libgpod (available here) or maybe use it outright for writing your own OOB manglement utils.