Just a day or two after the last one, there’s a new AMP release (version 1.27). I am heroically trying to reduce the rate of version releases, I hasten to add! But if I come across a bug that needs fixing, my hands are rather tied to making the fixes available as soon as possible!
Sure enough, whilst this releases introduces a useful new feature, it also fixes a quite significant bug I just encountered.
First, the new feature: if you ever specify ––maxduration=x and/or ––minduration=x, those are filters which are applied after a selection of music to play has been made from your music database, based on other factors you supplied as overrides. For example, you might say:
amp --unplayedworks --maxduration=30
“Unplayed works” is a selection override: it makes AMP ask for selections from available ALBUM table entries which do not have corresponding entries in the PLAYS table. Fine: but the ‘does this thing take longer than 30 minutes to play?’ question can only be asked after something has been selected by that initial selection process (which is why I refer to “maxduration” and “minduration” as filters, rather than overrides: they don’t alter the basic selection process, but merely filter the results of that selection). The reason for doing it this way is simple: the AMP database doesn’t compute (and therefore doesn’t store) the duration of recordings: the database full refresh will do so, but that’s not the default and there’s no requirement for you to do one of those, ever. The default is ‘fast refresh’ -and it’s fast precisely because it doesn’t go around measuring play lengths for every recording it comes across!
So this sets up a bit of a select-test-retry loop. AMP will select something to play which it hasn’t played before; then it will measure its play-length… and it may discover that what it selected turns out to last longer than 30 minutes. It therefore discards that selection and tries again. Each time, it selects, tests the play length, discards… and so ad infinitum until, by chance, one of its selections happens to last for less than 30 minutes.
The new feature in version 1.27 of AMP is that it is no longer an ad infinitum process. There’s now a hard-limit of 50 select-and-test iterations before the program throws its hands up and declares that it can’t speedily find anything that meets all your selection criteria. You can then just relaunch AMP with the same selection criteria as before and hope it gets lucky second, third or fourth time of asking (it happens!), or you can relaunch AMP with a less restrictive set of selection criteria -for example, increase the maxduration to 45 minutes or more.
The display of the selection process now shows this limit and the count of select-discard rounds as it makes them:
Here, you can see I’ve run through 17 of my allowed 50 select/discard rounds. If it gets to the limit without having found anything that meets all your selection criteria, you’ll see this message:
Why stop at 50? Er… no real reason, other than 50 is a round(ish) number and takes about a minute to complete. I figure waiting a minute for music to play is acceptable, but anything much longer than that probably isn’t.
It was whilst adding this fairly minor, but useful, new feature that I discovered a bug in the way AMP tests for whether or not a recording has previously been played -and I’m afraid it’s a repetition of a bug I’d addressed elsewhere in the program weeks before, so I have no real excuse! If your recording name contains one or more single quotation marks (such as Bizet’s Jeux d‘enfants or Prélude à l’aprés-midi d’un Faune, which has two of them), then the query of the PLAYS table to see if something has been previously been played would break. The result would be that the piece would be played, whether or not it had ever been played before. For such apostrophised recordings, the concept of ‘unplayed work’ didn’t apply, basically.
Well, it does now! Version 1.27 correctly escapes the relevant query so that one or more single quotes within a recording name won’t break things.
The usual upgrade rules apply: run the command amp ––checkver and you’ll be prompted to upgrade automatically. Alternatively, download the new script from the usual page and replace the earlier version with it yourself.