The Nokia 770 has little storage capacity, the largest RS-MMC cards on the market are 1Gb, and it doesn’t support networked file systems, so I cannot access my music via NFS or Samba and I can’t carry much on the system itself.
Streaming was the way to go, it seemed.
It proved at bit harder than expected, though.
mod_musicindex
First I tried with the Musicindex module for Apache2. It worked quite well with other systems, but it insisted on sending the playlists with the mime type audio/mpegurl, which isn’t associated with the Audio Player on the Nokia 770, so I had to download the playlists and open them manually in the Audio Player.
Apparently, Nokia 770 wants playlists with the mimetype audio/x-mpegurl and not audio/mpegurl.
I tried just about everything with AddType, ForceType and rewrite rules, without much success.
GNU MP3 daemon
I them switched to GNUMP3d which is a separate program, that is, not a module for Apache.
That too worked well with most normal music players, but not so with the Nokia 770’s Audio Player.
I kept getting messages about malformed playlists and if the playlist loaded, it would just skip from one song to the next without playing anything.
The two problems are completely independent, it seems.
The Nokia 770 Audio Player wants playlists to be valid and correct UTF-8. Otherwise they are turned down.
I run my systems with a default UTF-8 locale (a mix of English and Danish) so alle my filenames are in UTF-8. The tags in my mp3 files were in ISO-8859-1, however.
GNUMP3d builds a small database with the tags from mp3 files which also contains the filenames, so that file becomes mixed UTF-8 and ISO-8859-1. The playlists generated by GNUMP3d then also becomes mixed, and the Nokia 770 player refuses to use the playlist.
Consequently, I had to redo all the tags in my mp3 collection. I tried to convince gnump3d-index to convert the data, but never got it to work. Redoing the tags was easier after all 🙁
Some songs kept causing errors, almost no matter what I did. Apparently GNUMP3d doesn’t handle songs whose title or filename ends with a �. This is one of the weirder bugs I have encountered (reported to Debian as bug 340989). The accented letter � is encoded in UTF-8 as � followed by the byte �240 which is a non-breaking space in ISO-8859-1. When writing the metadata database, GNUMP3d trims the fields for leading and trailing whitespace, and this causes the � the remain alone which is not valid UTF-8.
I didn’t feel like rewriting the entire metadata database for the program, so I just changed the titles and tags to include a final period. That solved the problem for now.
After some time I got the gnump3d database to validate as UTF-8 by trying to convert it to ISO-8859-1 with iconv(1).
GNUMP3d still told the browser the pages were in the default charset of ISO-8859-1, and it took me quite a while to find the correct way to fix it. Simply add the line
add_meta_tag = <meta http-equiv="Content-Type" content="text/html;charset=utf8">
to the file /etc/gnump3d/gnump3d.conf.
Nokia 770 Audio Player
So far, so good. I now had playlists that the Audio Player accepted. Too bad it didn’t play anything, because it skipped silently from one file to the next, until it hit the end of the playlist.
Researching the problem a bit and studying the access and error logs of GNUMP3d (which has its own little web-server build in) revealed a bug in the Audio Player (reported as bug 296). It seems it encodes the urls in the playlist even though they are already encoded, so a space in an url, written in the playlist as %20, becomes %2520 when it is returned to the webserver (which in this case is GNUMP3d).
Since I cannot fix the bug in the Audio Player, I made a workaround in GNUMP3d, with this little patch:
--- /usr/share/perl5/gnump3d/url.pm~ 2005-11-19 18:28:41.000000000 +0100 +++ /usr/share/perl5/gnump3d/url.pm 2005-11-27 14:49:07.000000000 +0100 @@ -74,6 +74,9 @@ # This '+' -> ' ' conversion shouldn't be necessary .. # It's here to correct possibly buggy calls. $text =~ s/+/ /g; + + # Nokia 770 audio player workaround + $text =~ s/%25([0-9A-H]{2})/%$1/g; # # Unpack %XX characters into their intended character.
Its not a beauty, but it does the trick, and the 770 Audio Player can get the files and play the music.
Leave a Reply