June 2006 Archives

Sun Jun 25 17:36:53 CEST 2006

Compiling an MP3 CD for the car

We bought a new car yesterday, and it's all white and pretty. And it's got an MP3 player. So we now have to burn MP3 files onto a CD, is life hard or what?

So, I already use jack to automate ripping. It works really well and is easy to use (basically you just need to type in 'jack -q' and get the resulting files in ~/jack 20 minutes later).

Now, one problem is that CDDB filenames tend to have many spaces, and I worry the MP3 reader won't like that. So here we shall clean up all the filenames:

rename 's/-//g' *            # remove dashes
rename 's/\.(?!...$)//g' *   # remove dots that aren't for the extension
rename 's/ //g' *            # remove spaces
rename 's/^.*?(\d)/$1/' *    # remove band and album name
rename is an absolutely brilliant tool for this sort of stuff...

I'll then need to convert everything from ogg (my storage format of choice) to MP3:

find . -name "*.ogg" | xargs oggdec   # Decode all to .wav
find . -name "*.wav"  -exec lame {} {}.mp3 \;  # encode all to .mp3
# Move the mp3's somewhere else:
cd /tmp
find /path/to/mp3s -name "*.mp3" | xargs tar cf - | tar xf -
# Remove the .wav from filenames
for i in *; do (cd $i; rename 's/\.wav//' *); done

We're now ready to burn, baby, burn!

mkisofs -J -o out.iso .
cdrecord dev=/dev/cdrom -eject out.iso
And voila, we're finally done. I'll have to check whether renaming the files really is useful (and thus potentially sacrifice a blank CD...)

Wed Jun 14 22:48:40 CEST 2006

More UTF-8

Hmm, it looks like it's a lot of applications that are going to need some help along the line.
  • vim: :set encoding=utf8
  • less: export LESSCHARSET=utf-8
Converting files from one encoding to another is easily done with iconv:
iconv -f iso-8859-1 -t utf-8 file > file.out
Right, I can now move the entire Web site to UTF-8 then.

Wed Jun 14 01:06:23 CEST 2006

UTF-8 and the world

I think I've been tiptoeing around the subject for long enough: I'm just going to have to look at UTF-8 and Unicode. We've just bought several boxes of painkillers, so now's the time. (You've got to be prepared for these things in France, as you cannot buy painkillers anywhere else than at a pharmacy. The other day when we mentionned to the pharmacist that painkillers where available in any supermarket in Britain, she looked horrified and mentionned the dangers of combining them or having them with alcohol. Darn, is there a wave of aspirin-related deaths in Britain I haven't heard of?)

So the first step is to get support in the terminal. Apparently my xterm already supports it if I just start it with -en UTF8, or select it in the xterm menu (ctrl-rightclick on it), or if I have the proper locale. I'm a little scared of changing locales, when I do everything usually goes wrong.

So really all we need is fonts.

apt-get install xfonts-efont-unicode xfonts-efont-unicode-ib
The -ib is for italics and bold. With this I now get accents and Japanese characters, which looks really cool. Nevermind, I don't quite speak Japanese just yet.

Then let's do the locale: we'll generate a new locale that supports UTF8 using

dpkg-reconfigure locales
and add the chosen locale in .bashrc, in my case:
    export LC_ALL=fr_FR.UTF8@euro
Right, that doesn't work. I'll just use LC_ALL=fr_FR@euro and start xterm with -en utf-8 for now. There seem to be a bug in the Debian xterm (#318923) that will prevent me from changing the default in /etc/X11/app-defaults/Xterm-color.

We'll then need to adapt some apps to the changed environment. Mutt needs charset="utf-8" in its .muttrc. Vim needs :set encoding=utf8.

Mon Jun 12 23:20:32 CEST 2006

Translating navbars

And here I am, back on the treadmill of translation. I've finally cleaned up my act on the XHTML front and sent all that to the Po4a developers. I'm now off to tackle the translation of the navbar: I'll need a Po4a module for the format I've defined (somewhere else on my Web site). Think if only I'd used XML to save the data, I'd be done in 4 minutes.

Sun Jun 11 14:35:11 CEST 2006

Burning video dvd

I recently found some films on the internet that come as a 4.7GB stack of VOB files. They're DVD images, that can be burnt following the simple process:
mkdir -p dvd/VIDEO_TS
mv * dvd/VIDEO_TS
mkisof -dvd-video -udf -o dvd.iso dvd/
growisofs -Z /dev/cdrom=dvd.iso