2005-09-28

Hacking the playlist II

In a previous post, I was extolling the virtues of the moosic audio server, and mentioned that I wanted to create a nice on-screen display showing what's currently playing. As it turns out, it's much easier than I hoped, thanks to two useful Perl modules: Audio::Moosic and X::Osd.

So, without further ado, here's the Perl script. I call it moosic_osd.pl, but you can call it whatever you like.

#! /usr/bin/perl -w

use Audio::File;
use Audio::Moosic;
use X::Osd;

my $osd = X::Osd->new(3); # arg means 3 lines

$osd->set_font("-adobe-helvetica-medium-r-normal-*-*-100-*-*-p-*-iso8859-1");
$osd->set_colour("Red");
$osd->set_timeout(30);
$osd->set_pos(XOSD_bottom);
$osd->set_align(XOSD_right);
$osd->set_horizontal_offset(0);
$osd->set_vertical_offset(10);
$osd->set_shadow_offset(1);

my $moo = Audio::Moosic::Unix->new();

while (1)
{
    my $fspec = $moo->current;

    if (! $fspec)
    {
        $artist = "John Lennon";
        $title = "Two minutes silence";
        $album = "";
    }
    else
    {
        my $af = Audio::File->new($fspec);
        $artist = $af->tag->artist() || "";
        $title = $af->tag->title() || "";
        $album = $af->tag->album() || "";
    }
    $osd->string(0, $title);
    $osd->string(1, $artist);
    $osd->string(2, $album);

    sleep(1);
}

So, copy and paste that somewhere, and run it as a background job:

perl ./moosic_osd.pl &

...and you'll get a nice little on-screen display.

Tags: , , , ,

2005-09-23

GP2X will be Dad's toy

My son gets all the good stuff. The Rio Karma, the PS2, the GameCube. Every time some cool gadget comes along, someone in the friends-and-relations gift mill buys it for my son. Hell, sometimes it's me, as in the case of the Karma. That, of course, was part of my open-standards education program for him, since the Karma had support for Ogg Vorbis format audio files. So, I don't begrudge him his teenager toys.

I do get jealous, though.

The one that hurt the most was the Playstation Portable (PSP). My wife happened to be at Target the day the PSP was released, and happened to ask the electronics clerk about it, and he happened to have one that hadn't already been claimed. So we had one in the house on the day of release. I wasn't allowed to claim it for myself, because my wife already had it on my son's gifting schedule.

It's just as well, because it's my turn now. The GP2X is coming out in October, and I've already pre-ordered. I'm a long-time Linux hacker, and now a portable game machine with a Linux kernel and bundled SDK comes along. At the risk of employing an overused geek codeword, w00t!

And yes, I know about the DRM, as reported on BoingBoing. The UK folks have posted a reasonable explanation, and I'm going to take them at their word.

So, it should be here sometime next month, at which time I'll report on it. And, in case I didn't make this clear: This one is mine, son.

UPDATE: Officially, it's called the GP2X, not the GPX2, so I fixed that.

Tags:

2005-09-15

If I'm not here, it's Wikipedia's fault.

It's fairly obvious that blogging has not become an obsession with me. Let's see... I haven't checked in since March. For me, that's not bad.

A lot of my online time these days is spent contributing to Wikipedia. For those people who haven't encountered this yet, it's an encyclopedia inside a wiki, with no edit restrictions. In other words, anyone on the net can edit any page, either credited or anonymous. Short-term accuracy is always questionable, but most pages end up with concerned nannies watching for every edit and pouncing on incorrect information and vandalism.

All the regulars in this wiki, who have dubbed themselves Wikipedians, tend to gravitate into interest groups. I've ended up concentrating on musical theatre, certain favorite rock and roll performers, and chess. My two major contributions were articles on Harry Nilsson and Jack Gilford.

I encourage everyone to stop by the Wikipedia, and can guarantee that if you surf there for more than five minutes, you will end up editing something.

Tags: