On another note, I stupidly forgot to turn the server database back on! Whoops.
All posts by admin
Super conversion script
I’ve written a script to convert .flac files to .mp3 and retain a useful directory structure. This is mad-handy for my w800i phone.
source_path="${1%/}/";
dest_base="${2%/}/";
bit_rate=$3
if [ ! -r "$source_path" ]; then
echo "Source path not found."
exit 2
fi
if [ ! -r "$dest_base" ]; then
echo "Destination base path not found"
exit 2
fi
if [ ! $bit_rate ]; then
echo "No bit rate specified, defaulting to 128kbps"
bit_rate=128
fi
artist_album=`echo "$source_path" | sed 's:^.*/\([^/]*/[^/]*/[^/]*\)$:\1:'`
dest_path="$dest_base$artist_album"
# Check out source dir
if [ ! "$(ls -A "$source_path"*.flac )" ]; then
echo "No .flac files found in source path."
exit 2;
fi
cd "$source_path"
ls | grep .flac | while read file ;do
# Each flac
title=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "TITLE=" | sed "s/comment\[0\]: TITLE=//g" | sed "s/^ *//g"`
artist=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "ARTIST=" | sed "s/comment\[1\]: ARTIST=//g" | sed "s/^ *//g"`
tracknumber=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "TRACKNUMBER=" | sed "s/comment\[2\]: TRACKNUMBER=//g" | sed "s/^ *//g"`
tracktotal=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "TRACKTOTAL=" | sed "s/comment\[3\]: TRACKTOTAL=//g" | sed "s/^ *//g"` album=`metaflac --list --block-type=VORBIS_COMMENT "$file" | grep "ALBUM=" | sed "s/comment\[4\]: ALBUM=//g" | sed "s/^ *//g"`
echo "Converting: $artist - $album [$title]"
flac --silent -d "$file"
wavfile=${file%.flac}.wav
newfile=${file%.flac}.mp3
lame --quiet --tt "$title" --ta "$artist" --tl "$album" --tn $tracknumber --preset "$bit_rate"kbps "$wavfile" "$newfile"
done
rm *.wav
mkdir -p "$dest_path"
mv *.mp3 "$dest_path"
exit 0;
By no means perfect, but it does work. You will need flac and lame installed for this to work. Comments/suggestions welcome!
Server migration
Right, I’m moving john-hunt.com over to a new much much much faster server than this one. This will also save me £20 a month. You may experience problems trying to access the site over the next couple of days, but don’t worry, it will return!
Update:
All done, there shouldn’t be any loss of service, you should just notice it speed up a bit when your ISP’s master dns records get updated!
Audio CD checksum database
While extracting one of my favorite cds today and noticing it had heavy scratching on it, it occured to me it might have loads of errors while extracting. So I thought “I’ll just run an md5/sha1 checksum on it and verify it against CDDB’s checksums…” CDDB doesn’t have checksums for cd tracks. This is crazy.
I might have to set up my own database….if I ever get time.
Please let me know if you know of one.
Update:
So anyway, I had a look at md5 sums, to see if they’re the same on different cd rom drives. They are, but as commented below, you need to provide the drive offset. Me and some other guy called Michael are looking into it. As for the actual database…I had some thoughts on that, but it’s a pretty big project. Not sure what actions to take with limited time.
Update 2:
Found a database, although it’s not online, and it’s windows only…not really the cddb way. Have a look at accuraterip.com. More soon.
Sony Ericsson w800i
I recently got a w800i mobile phone and I’ve been playing with it for about 24 hours now. It’s not bad at all! If you’re looking for an mp3 player phone thing, it’s rather perfect.
Works with Linux too (mass storage device stylee!)
What’s really cool is you can bluetooth your tunes to other people.
More here soon, maybe some pictures also. Or perhaps just check out the w800i forums!
Suspend S3 on IBM Thinkpad R50e
Well, this one has had me stuck for ages…but Antoine from the linux-thinkpad mailing list managed to help out (thanks v.much!).
This mini-howto should help you get suspend working on your R50e, and perhaps many other laptops with the intel extreme graphics 2 chipset. The main problem is that the display is not restored properly or at all and you’re left with a blank screen.
Another symptom (that I was having) which was really frustrating me was I was left with a
Stopping tasks========
Screen when I hit Fn to resume, also the suspend light stayed on and the whole laptop was locked up. The reason for that was because I had the s3_bios= kernel param in my grub.conf, make sure you remove this.
Also, I’ve read that you’re not supposed to have any kind of framebuffer in your kernel or as a module…even un-loading the fb module won’t help; so make sure you remove all traces of framebuffer stuff from your kernel if it’s compiled in, or alternatively make sure the modules aren’t loaded on boot.
Ok? Right then. Read this guide:
How to make ACPI work
Make sure you don’t do this, it’ll cause symptoms of annoyance as described above:
acpi_sleep=s3_bios
Ok, so now check that we’ve got ACPI working.
As root:
dmesg | grep supports
and you should get this:
ACPI: (supports S0 S3 S4 S5)
Even if you don’t get that, you might as well try it. Here’s the script:
#!/bin/bash
chvt 1
cat /proc/bus/pci/00/02.0 > /tmp/video_state
sync
#------------------- [ Enter Sleep Mode ] -----------------------------
hwclock --systohc
echo -n 3 > /proc/acpi/sleep
hwclock --hctosys
#---------------------------------------------------------------------------
cat /tmp/video_state > /proc/bus/pci/00/02.0
chvt 7
rm /tmp/video_state
That also prevents the clock from drifting.
I’ll be updating this guide a bit when I have time.
Jabber (not the hutt)
People ought to stop using MSN. Did you know that Microsoft legally own everything you write on there? Start using the Jabber IM protocol. There are various clients out there for windows, one of them is called exodus which looks alright. Myself, I use gaim, which is primarily a linux client although I think there may be a windows version around.
It’s a good idea to start using something else, otherwise you’ll find microsoft taking over your lives even more.
Oh, my login on jabber is johnrhunt incase you were wondering.
Rhythmbox 0.9
Version 0.9 of Rhythmbox is out!
Requires a lot of dependancies, but I’d recommend it.
Or get the source here:
Rhythmbox download page
Wireless networking in Gentoo
This is a work in progress
Fire up dhcp on the wireless interface: dhcpcd eth1
(that should create the device also kinda thing)
The init script (/etc/init.d/wireless)
#!/sbin/runscript
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
depend() {
before net.eth0
}
start() {
#! /bin/sh
# wifi: wpa_supplicant init
echo " * [Wifi]: Enabling WPA supplicant..."
if [ -x /sbin/wpa_supplicant ]; then
wpa_supplicant -B -i eth1 -c /etc/wpa_supplicant.conf -D ipw -w -dd
dhcpcd eth1
fi
}
stop() {
echo "Stop doesn't work yet!"
}
restart() {
echo "Restart doesn't work yet!"
}
rc-update add wireless default
Then we configure /etc/wpa_supplicant.conf
#CONFIG_CTRL_IFACE=y
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="home"
scan_ssid=1
proto=WPA
key_mgmt=WPA-PSK
psk="somepass"
}
Then hope for the best I guess!
Gentoo on Thinkpads
While setting up my new laptop, I’ve found quite a handy guide for getting Gentoo working on IBM thinkpads:
Gentoo Linux on IBM Thinkpad
Hope it helps you as much at it helped me.