Wednesday, July 12, 2006

I can Browse Artists. Cool.

Browsing by artist actually works, and appears to work with both mt-daapd and iTunes. It should now be trivial to enable browsing by album and genre. "Browsing" used to be done the BFI way (ie. get a list of all songs and throw out the ones we're not interested in) which is perfectly valid, especially when more sophisticated mechanisms are not well (or at all) documented. For large collections of audio files sending browse requests to the DAAP server pushes all the "heavy lifting" over to the server, which probably runs faster and just generally has more resources than the WMA11b. Between browsing and smart playlists it should be possible to cut down on network traffic in many cases. What I have noticed though, is that iTunes sends a sorted list of, say, artists, which is not great for our binary tree sorting code. Sorting by adding items to a binary tree can be very cheap, but it presumes that the data being added is unsorted. Adding already-sorted items to the list is a worst-case scenario that causes the code to do the maximum amount of work.

It remains to be seen how much of the mt-daapd documentation I found yesterday can be used with the DAAP protocol. Basic browsing appears to be supported, but mt-daapd also allows for browsing with filtering (ie. browse all albums by a specified artist). It would be nice to be able to use these as well, but if they do not work with iTunes or other DAAP servers then there's a diminishing reward for implementing them.

For now I think I will content myself with implementing the browsing that I am confident will work across platforms, and then addressing issues like stability and performance. I saw tonight another deadlock of some sort, where I stopped the song that was playing and then tried to cue up a new set of songs, but nothing happens. Playback appeared to be impossible at this point. I thought I had found all this problems, but apparently not.

Labels: