I've been going on about arename version four for a while now. Like in "it'll be the best thing since sliced bread" kind-of preaching. It won't be that good, obviously. But it will deal with a few smaller or bigger problems that version three had.

The biggest problem with arename is, that it started out as a quick hack. I just wanted to keep the names of my music library in line and there was virtually nothing out there that could do it. And when there was something promising featurewise, it was always obscure enough that I wouldn't trust my whole library to it. After all having to re-rip all my audio CDs would be a major undertaking.

Anyway. The point is, that I never had planed to add so many features. With version 1.0, I was sure it was feature-complete; same for 2.0. After that I realised, I would have to restructure things a little. To give you an idea: I was running out of decent single-letter options. So I needed to break backwards compatibility. Which is why version 3.0 happened less than a year after 2.0.

And 4.0 is (or rather, will be) much of the same. I wanted support for more file types and wanted to get rid of a lot of the ugly glue to hide the differences between the backends I used, so I had to switch to a different, more capable, backend: Audio::Scan.

A new backend surely meant breaking backward-compatibility - again. There was no way around that. So I figured "In for the penny, in for the pound...", and decided, I should rewrite the template parser, too.

The old one was a pretty naive approach at expanding the template. It's actually possible to send the code into an endless loop with properly contructed tag-values. And that's obviously a-bad-thing[tm].

I wouldn't just rewrite the parser into something sane, no, I would also extend its features. So there goes backward compatibility (yeah... again). Most old templates will still work as they used to, however. You'd need to have fairly twisted things in there for the behaviour to change... but still.

Then, kind of as a last-minute thing, I completely rewrote the old output system (the ‘--verbose’, ‘--quiet’, ‘--uber-quiet’ mess). So that breaks compatibility, too. Albeit, I tried to be reasonable here and not throw errors here, but replicate the old behaviour as much as possible and deprecate the old options (they definitely will be removed at a later point).

After all that compatibility breakage, what is the new stuff in arename4 capable of doing?

First of all, there are a lot more supported file types. It used to be ‘mp3’, ‘ogg’ (ogg vorbis, that is) and ‘flac’. Now the list looks like this:

  • AAC: aac
  • APE: ape, apl (Monkey Audio)
  • ASF: wma, wmv, asf
  • FLAC: flc, flac, fla
  • MP3: mp3, mp2
  • MP4: mp4, m4a, m4b, m4p, m4v, m4r, k3g, skm, 3gp, 3g2, mov
  • MPC: mpc, mpp, mp+ (Musepack)
  • OGG: ogg, oga
  • WAV: wav, aif, aiff
  • WV: wv (WavPack)

And that's all thanks to Audio::Scan, which also unifies the meta-data reading process, so all file-type specific processing (esp. hooks) is gone now.

Also, like I said, the output system was completely rewritten. For the user, on the one hand that means: the level of verbosity is handled by exactly one option: ‘--verbosity’. On the other hand, there are colours now. Yes, arename4 output looks like this now:

arename 4 coloured output

If you're one of those guys, who think colours are made in hell, you can turn them off by doing the following in your shell setup:


And finally, templates are now vastly more powerful. Let me show you. The plain old template still may look just like this:

&artist - &album - &tracknumber - &tracktitle

If you're like me, and define a lot of templates directly on the command line, that sucks because it's a lot to type. If you enable the ‘template_aliases’ option in your configuration, you can do the same like this:

&ar - &al - &tn - &tt

Now, say you got a few tracks in your library that lack a proper album name. Back in the olden days, you'd hack up a ‘pre_expand_template’ hook that does something about that. And indeed such a hook is still included in the ‘arename.hooks’ example file.

But if you'd just like to insert a "\" for missing albums you can now do:

&ar - &{al:<noAlbum>} - &tn - &tt

The "&{foo:bar}" form inserts ‘bar’ if the ‘foo’ tag is not available in the current file. Nice, huh? Now say, you'd just like to drop the album and tracknumber parts entirely if the album tag is missing. You'd do this:

&ar - &{al?&al - &tn - !}&tt

The &{foo?bar!baz} form inserts ‘bar’ if ‘foo’ is set and ‘baz’ if it is unset. On top of that, you can nest these expansions as much as you'd like. That means that both ‘bar’ and ‘baz’ will be expanded just as a normal template string would be. That is why we can just use "&al" etc. in the ‘bar’ part in the example above.

Here are those examples in action:

arename 4 extended templates in action

That's most of the major user-visible changes in version 4.

Code-wise, I think the new release will look a lot more pleasant than any arename before. Feature-wise, I think (for real, this time) arename can do everything anyone could ever want, since special needs can be handled in user-defined hooks. And I'd rather add more hooks than adding any more core features.

Roadmap-wise, the plan looks like this: release 4.0 soon-ish. And fix bugs as they come in. Then, after a year or two, remove all the deprecated stuff and release a further cleaned-up version 5, with which I'd like t conclude arename's active development any switch the project into maintenance only mode.

Needless to say, you're welcome to try arename v4.0-rc2 today. Clone the repository from github, generate the scripts and documentation and finally run the test-suite:

% git clone git://github.com/ft/arename.git
% cd arename
% make genperlscripts
% make doc
% make prepare-test-data
% make test
% sudo make install install-doc

You'll need a few things to run the test-suite (‘prepare-test-data’ and ‘test’). See the TESTING file for details. If you have all the prerequisites in place, none of the above should fail. If it does, please report.

If you find anything else that is off, please report. There is also a REPORTING_BUGS file now.

That's it for now. Give arename4-rc2 a spin and tell me if it misbehaves. Use the ‘--dryrun’ (short: ‘-d’) option to see what would be done before leaving it out.

Posted Mon 31 Oct 2011 11:25:38 CET Tags: