mwolson.org Blog - /Personal

Sat, 26 Nov 2005

Thanksgiving 2005

I took my roommate Scott with me to my maternal grandparents' house for Thanksgiving Break. During the traditional meal with the aunts, uncles, and cousins, I proposed to set up a sort of gift wiki.

The idea is that people will have until Dec 1 (or some other arbitrarily-chosen date) to edit their personal wiki page, listing the Christmas gifts that they would prefer to receive this year. After this date, they will not be able to view or edit this page, but everyone else can. People can list which gift they are going to give someone by editing that person's page, preventing the reception of duplicate gifts. The weakness of this method is that two people working together can collaborate to figure out what the other will be receiving for Christmas.

I hope to get that all set up tomorrow and send an email to everyone who will be participating.

It was fun driving Scott around town, playing Canasta (a card game), and trying to find a friend of Scott's family to visit. I was impressed that Google Maps can mark exactly the house that we needed to visit.

Some of the music that I had purchased the past weekend came in the mail while I was gone. I'm now blissfully discovering The Smashing Pumpkins. Tomorrow I will be giving my room a thorough sweeping and mopping. Maybe I'll even read through my textbooks, though doing so usually has no tangible reward in my schoolwork or grades.

I managed to make the mistake of running a newly-made script without backing up my stuff first. The result was that all of my playlists were wiped out, even though the music itself was intact. I created a script that tries to re-create the playlists, even preserving track order, when possible. It's pretty slick, for the most part. I found out the hard way that my CD ripping software had not been saving the track number of the recent songs that it had ripped. This is remedied now, but it will mean a lot of work for me, having to re-order about 20 albums.

Without further ado, here's the script that I made to re-create my playlists.

#!/bin/bash

pre=/stuff/sounds
pldir=albums
ripdir=ripped
tmpfile=/tmp/tmpplaylist

function write_entry () {
    echo "$pre/$i/$j $num" >> $tmpfile
    touched=t
}

function do_sort () {
    sort -n -k 2,2 $tmpfile | awk '{print $1}' \
        > $pldir/$(basename $i)-$oldexpr.m3u
    : > $tmpfile
}

for i in $(find $ripdir/ -mindepth 1 -maxdepth 1 -type d -print | sort); do
    touched=nil
    oldexpr=nil
    echo -n "Processing $i ..."
    : > $tmpfile
    for j in $(ls $i/*.ogg | sort); do
        j=$(basename $j)
        expr=${j%%-*}
        num=$(ogginfo $i/$j | grep tracknumber | sed 's/^[^=]\+=//')
        if [ "$expr" == "$oldexpr" ] || [ "$touched" == "nil" ]; then
            write_entry
        else
            do_sort
            write_entry
        fi
        oldexpr=$expr
    done
    if [ "$touched" == "t" ]; then
        do_sort
        echo " done."
    else
        echo " skipped."
    fi
done

rm $tmpfile

NP: Smashing Pumpkins - Porcelina Of The Vast Oceans

Add a comment

Name: 
Your email address: 
Your website: 
 
Comment: