Class::Persist 0.30

I’ve done something I’ve wanted to do for ages – get another release of Class::Persist out. This one I consider massively improved over the last one – it’s dropped some of the nastier dependancies, doesn’t require it’s own magic database
tables to be created, can properly put objects into more than one database, and, my personal favourite new feature, all objects are maintained properly as ‘singletons’ – you can only have one copy of any given object around at any one time.

The release should be here: Class::Persist 0.30.

AudioFile::Identify::MusicBrainz

After much muttering back and forth between blech and I, I have written and released AudioFile::Identify::MusicBrainz. The old MusicBrainz client relied on the C library they distribute, which was silly for something that sent and recieved pure RDF, so a pure-perl implementation was just begging to be written.

So, upsides, it works, there’s exactly one sort of query you can send it, but that’s fine, it’s the important one – you can say ‘I know this about a track, tell me more’. The next step is to give the user a nice choice, and then let them write the updated information back into the ID3 tag.

Downsides, I’m not using ‘real’ RDF parsers, I’m using XML::DOM. This worries me, frankly, I’d much rather do the right thing, but I get a headache trying to make the perl RDF stuff work. There’s an RDF::Simple out there now, though, so maybe I’ll try that…

I’m going to get a reputation here for stupidly long module names, you know.

blogroll

Ah ha! I have a blogroll. Ph33r me.

In other news, Template::Plugin::XML::Simple is really nifty.

<p class="code">
[% USE blogroll = XML.Simple('/export/home/tomi/web/jerakeen.org/blogroll.opml') %]
&lt;p class=header&gt;blogroll&lt;/p&gt;
&lt;p&gt;
[% FOREACH section = blogroll.body.outline %]
  &lt;a href="[% section.htmlUrl %]"&gt;[% section.text %]&lt;/a&gt;
  [% UNLESS loop.last %]&lt;br /&gt;[% END %]
[% END %]
&lt;/p&gt;

broken tick

I’m releasing another Bot::BasicBot at the moment, to change the semantics of the tick() method. Instead of getting called every 5 seconds, you now need to return a value from the tick() method, and you will be called again in that many seconds. this is waaay more useful than before, but of course it’ll break anything that uses it. Oops. But 0.2 has only been out a short time, so I should get away with it.

More of a problem is what to do with Bot::BasicBot::Pluggable, because I now can’t just pass the tick method straight through. I have a new version in CVS that I’m very happy with, needs more tests, though, but the feature still stopping release is per-module tick events. I want every module to be able to have independant tick events, instead of sharing one global tick, but haven’t come up with an elegant way of doing it yet..

build_m3u

I was reading this article on m3u files and decided to scratch one of my long-term itches, building a decent windows playlist on the file server. It’s a.. large collection, so I don’t want to build things on the client end, you see, it takes bloody ages.

Up till now, I’ve just created a list of paths, and used that as the playlist. This had 3 disadvantages:

  • it’s very hard to have it sorted by anything useful, using the filename is hopeless as there are several different naming conventions involved. blech’s fault.
  • I’d quite like to have the track lengths already by the tracks when winamp starts, as opposed to have it add them whenever you see them.
  • for some reason, winamp starts much faster when there are EXTINF tags in the playlist file. Don’t know why. Don’t care.

So now I search the server for files, read the id3 tags, sort by artist/album/tracknum/title and print out, along with the track length and name in an EXTINF tag. The whole process takes almost exactly 2 mins, but it’s not very memory-efficient. For various complicated reasons the server has almost a gig of memory in it (ok, they’re not complicated reasons – we just don’t own any other boxes that can use the stuff) so I don’t care about this.

code is here, if you care. It’s hard-coded for my server, but the only thing you’d really need to change is at the beginning, where $root and $remote are defined – $root needs to be where the music lives on the server, $remote is where it lives on the network. For my server, I samba share /music on the server cowboy as cowboymusic. Also, $playlist should be where you want the playlist to go.

CGI::Wiki::Kwiki

Well, in the end, rather than fold my code into CGI::Wiki and its example scripts, Kake has persuaded me to release the thing as an actual module. So, the world now has CGI::Wiki::Formatter::Kwiki and CGI::Wiki::Kwiki. I’m not sure about the name of the latter, but given that is was mostly written as a Kwiki importer and front end, it made the most sense. I hope that people also realise that it doesn’t have to have anything to do with Kwikis at all, and can be used as a stand-alone wiki front end..

They still have very small version numbers, the formatter needs code, tables and comments, and the Wiki front-end needs tests (bad me), but as far as I can tell, for the most part they both work. The code is much cleaned up from the “last release”:/blog/programming/CGI-Wiki, all modular and everything, I’m much happier with it now.

You can get them both from CPAN.