Archive for July, 2006

iRiver T10

Friday, July 14th, 2006

I bought a new MP3 player a few days ago. Its one of those Windows Media Player “Plays for sure” devices which uses Microsoft’s media transfer protocol. On Linux there is libmtp but I would much rather have a USB mass storage devices that I can copy files to and from on any computer. Luckily the iRiver lets you change to UMS (USB mass storage) through a firmware upgrade. Of course the firmware updater program requires a Windows XP machine with WMP 10 installed. Once the firmware update is complete, its back to Linux.

The main reason I bought this player is because it has long (45 hour) battery life and Ogg support. I wonder why iRiver makes the default firmware require WMP 10 when that terrible program doesn’t even support Ogg? I mean if someone was really going to make use of the Ogg support, they won’t be the kind of person who uses WMP.

One problem I had with the player — and all other UMS players is that you — can put files in folders, but within each folder the songs are not listed alphabetically. Instead they are listed in the order you copied them to the player (presumably is just grabs the lowest disk address first). This is a problem because now all my albums play in the wrong order, unless I meticulously add them in the correct order.

As a UMS, this iRiver T10 does not support any regular playlist formats. I’m pretty sure on Windows using MTP you can add playlists, but on Linux using UMS you’re kinda stuck. No m3u or pls or any other kind of XML. However it does have this “QuickList” feature which lets you hold down a button and add the currently playing song to a playlist, like the iPod’s “On-The-Go” playlist.

So after making one of these I got the idea that I could make playlists and put all my songs in the correct order. But that would mean using the T10 interface then stopping, plugging in and transferring the playlist data somewhere else on the drive so I could create another one. Instead I just opened the playlist up in my trusty hex editor and reverse engineered it.

Luckily the iRiver playlists (*.pla) are not difficult to understand. They have a 512 byte header, followed by the paths for each song relative to the root of the drive. Each path takes up 512 bytes (the ascii data followed by null characters). For some reason every second byte throughout the whole file is 0×00. Is this UTF-16 and I am just using non-complex characters?

Anyway, I put it all in a python script. To make a playlist of the entire folder in alphabetical order just do:

ls | ./iRiverPlaMaker.py MyPlaylist.pla

You should run this on the iRiver disk so all the paths are correct and correspond to the root of the disk.

Why I Love Libglade

Friday, July 7th, 2006

The family computer in the living room (of the house that I am now moving out of) was recently converted to an Ubuntu machine. For about the last three years I have been trying different ways to keep it running smoothly. The last configuration was Windows 2000 with a limited account and a software firewall, but even on dial-up, the spyware and the worms got to it.

This computer is mainly used by my younger sister and younger brother for homework and surfing the internet. The three most used programs are Word, MSN, and Limewire. So I thought this would be a perfect use case for Ubuntu — and it is. It’s working flawlessly so far, even with sleep, but that’s because it has apm not acpi.

Anyway I’m not here to tell you my Ubuntu success story since everyone knows how it ends; the computer never has to be reinstalled or rebooted ever again!

I’m here to tell you about why I love libglade. Everyone knows how it is good for creating GUIs, even though the interface sucks, and how it takes a lot of the work out of programming. But in my case it was the XML that saved the day since it is easily readable to humans and does not need to be compiled.

The above is a screenshot of gnome-ppp when it is connecting (like I said the computer uses dial-up). My younger sister will sit at the computer and think, “Oh, ‘Log’ as in ‘Log-on’”, and will click the log button. But instead it brings up a window showing the log of all the modem commands sent during the connect process. Now she is confused, and we don’t want the user to ever be confused.

For some reason she can’t remember not to click on this button. So I opened up the glade file using this command:

gedit `locate gnome-ppp.glade`

I then searched for the gtkButton with the text “_Log”, edited, saved, and voila!

This particular program has instantly become much more usable for her — something that could never be done on Windows or MacOSX. Score for open source!