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:

2005-03-18

Hacking the playlist

Now playing: Bruce Springsteen / Lost in the flood

I've amassed a, well, massive amount of recorded music over the years. Lately, I've been methodically encoding it all to computer-readable formats, so that I now have a 20 gigabyte disk partition full of .mp3 and .ogg files. I've got no time to assemble playlists. What I want is to have a program to which I can say, "Go look in /media/music, and shuffle the lot."

Now playing: The Beatles / Mr. Moonlight (alt version from Anthology 1)

For the past year or so, I've been using the open source program gqmpeg for this purpose. There were two minor annoyances I found with this setup. First, it took forever to load up that 20 gig into its playlist. Second, I was tied to my X Windows session, because the player is tied to its GUI frontend. I wanted the player to manage the playlist invisibly. If I want to see what's going on, I'll ask the playlist manager.

Now playing: Original cast of 'Take Me Along' / We're home

So, I went on a search for a new playlist manager, and found moosic. Now, this does exactly what I want. It separates the playlist manager functionality from the user interface, and its default user interface is command-line! Outstanding.

Now playing: Leon Redbone / She's my gal

Naturally, I couldn't leave well enough alone. The one weakness I saw with moosic is when I asked it what the currently playing song was, it would reply with the full filename. Well, I add nice Artist, Title and Album tags to my .oggs, so I want to see them. So, it's time for a Perl Hack.

#! /usr/bin/env perl -w

use Audio::File;
use Audio::Moosic;

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

my $fspec = $moo->current;
my $af = Audio::File->new($fspec);

my $artist = $af->tag->artist() || "";
my $title = $af->tag->title() || "";
my $album = $af->tag->album() || "";

print "$artist\n$title\n$album\n";

Now, of course, if you want constant display, a nice shell script will take care of that.

#! /bin/sh

onscreen=
while true
do
 playing=`perl ./main.pl`
 if [ ! "$playing" = "$onscreen" ]
 then
     clear
     perl ./main.pl
     onscreen=$playing
 fi
 sleep 10
done

By the way, the reason I separated this into the perl and shell portions (other than the fact that this is the Unix Way) is that eventually I'm going to pipe the output of the perl script into osd_cat, which does overlaid text.

Now playing: Clannad / Dheanainn sugradh

Eventually, this is going to lead to my extremely local radio station (only within the walls of the house), but that can wait until next post.

Tags: , , ,

2005-03-16

The DVD shelf

It's almost spring here in New Jersey, which means it's finally time for me to review my Christmas present, the DVD collection of the first five Marx Brothers movies. Hmm. How can I put this kindly? You know, I can't, so let me just jump right in. These movies are in horrible condition, and it looks like Universal made absolutely no effort at restoring them. The movies themselves are just as funny as I remember them, but it's really a shame that they've been released with such a shoddy transfer.

Much more satisfying is Warner Brothers' work on the Looney Tunes releases. The two "Golden Collection" DVD sets that have been released so far feature magnificent restorations of the classic animation shorts, great commentaries, and lots of extras. I highly recommend these.

2004-12-06

Bit of a dry spell

It occurred to me today that I hadn't made an entry to this random journal for quite a while. This is not necessarily a bad thing. Perhaps I just had nothing useful to say for seven months. Many a blog will fill up pages and pages with seven months of nothing to say. At least I've saved Google a few seconds of indexing.

It's the festive Winter Solstice season, which turns a greedy fellow like myself to thoughts of composing a Christmas Want List. On the top of this year's list is the DVD box set of the first five Marx Brothers movies. I've been getting my Marx fixes from old VHS off-air tapings for years now, so the new copies will be welcomed. I've heard that they didn't bother with a restoration, though. Bummer. If Santa comes through, I'll post a review come Boxing Day (give or take seven months).

2004-05-12

Fifteen minutes for the Alma Mater

My old high school was mentioned by Jay Leno in his opening monologue recently. On Friday, 30 April, he used the following joke.

Angry parents protested outside the Queen of Peace High School in North Arlington, N.J. yesterday because they were upset that the spring musical at the school this year is Cabaret. It's a play that deals with issues of homosexuality. Well, thank God they're picketing. The last thing you want is kids in the theater department being exposed to is anything gay.

Naturally, my first thought had nothing to do with the topic at hand. There's still a bizarre little thrill associated with having some obscure part of your life exposed to millions of people on television. I've been seeing Pizzaland for five years in the opening credits of The Sopranos, and it's still pretty cool, since I spent an inordinate amount of my teen years eating there. I especially liked the theatre angle of the QP story, since virtually all of my good memories of high school involved the drama club in some way.

Eventually, though, I got past the Warholian nature of the Tonight Show reference, and started thinking about the reality behind it. Parents protesting a high school show? Cabaret? In what century do these parents live, and what can we do to get them to join us here in the 21st?

After a little fact-checking, I discovered that the protests were nothing more than a few small-minded people, and that the attendant publicity made for packed houses. The actors took the protests in stride, and had a good show. More power to them.