Wednesday, February 04, 2009

Shit happens -- even to google

Everyone knows of the now infamous google malware database corruption. Google was able to fix the issue quickly, which is great and all. But what really impresses me is their open attitude when it comes to their end user products, like this post on the gmail blog.

You may be a big headless giant robot, but you're our big headless giant robot.

Sunday, January 11, 2009

Renaming MP3 by ID tag

Ever tried to recover from an IPOD dump, and get a bunch of files with the useless names? Here's a script to fix that.
$ ls *.mp3 | ./rename.pl - | while read line; do OLD=`echo $line | cut -d, -f1`; NEW=`echo $line | cut -d, -f2`; mv "$OLD" "$NEW"; done

And here's the perl script:

#!/usr/bin/perl
#
#Your Love Means Everything.mp3: (tag v1.0)
#songname: Your Love Means Everything
#artist: Coldplay
#album: Varie
#year:
#comment:
#genre: Other(12)
#

while( <> )
{
chomp;
my %hsh = ();
my @info = `id3ed -i "$_"`;
foreach my $iline ( @info )
{
chomp $iline;
#print $iline . "\n";
if( $iline =~ /songname:\s+\b(.+?)$/ ){
$hsh{ song } = $1;
}
if( $iline =~ /artist:\s+\b(.+?)$/ ){
$hsh{ artist } = $1;
}
if( $iline =~ /album:\s+\b(.+?)$/ ){
$hsh{ album } = $1;
}
}

my $newname = "$hsh{ artist }" . "-" . "$hsh{ album }" . "-" . "$hsh{ song }" . ".mp3";
$newname =~ s/\s+/_/g;
print "$_,$newname\n";
}

Monday, January 05, 2009

Autologging in and running app in X

I've been keen on doing this for some time, but a combination of:
  1. lack of need
  2. lack of time
have kept me from doing any real testing on a good solution. But someone has already done the work!