Duration-based Plays

Another week, another new version of the Absolutely Baching Music Player (AMP to its friends). We move from 1.10 to 1.11… and the new release contains two basic new features being introduced!

First, a new run-time parameter is provided called ––artsize=xxx. The ‘xxx’ values permitted are ‘small’, ‘medium’ and ‘large’, with ‘medium’ being the default if the parameter is not supplied at all, or if it’s supplied with an otherwise invalid value.

The parameter controls the size of album art that is displayed (assuming you are displaying album art at all). Small makes the art appear in a 300×300 pixels window; medium is 600×600; and large is  900×900 -which used to be the default, but has stopped being since I tried running on my ancient laptop which has a 1366×768 screen!

Second, a pair of new ‘filters’: ––minduration=X and ––maxduration=Y. These can be used in combination or singly. They restrict the albums that AMP selects for randomised play, whilst obeying all the other filter/overrides you may have specified. The idea is that you can stop AMP randomly selecting a big pile of 3, 4 or 5-minute works and instead concentrate on selecting nice, big half-hour-plus compositions for play!

They both take values in minutes and, for hopefully obvious reasons, maxduration has to be a bigger number of minutes than minduration!

The default value for minduration is 0 and for maxduration is 525960 (which happens to be the number of minutes in a year). By default, therefore, the effect of the pair is to permit any album of any (practical!) duration to play. If you do not supply the two parameters at all, you therefore are not effectively restricting what can be played at all. If you supply just a minimum duration, the randomiser will only select folders of music to plays whose contents are calculated to last longer than that minimum. If you supply only a maximum duration, only folders of music that take less that time will be selected for play. If you supply both parameters, then only those folders containing music whose durations are bigger than the minimum AND less the maximum will be playable.

If you supply invalid values for either parameter, the default values kick in -which is effectively the same as saying ‘we’ll ignore your erroneous input’. Thus amp ––minduration=10 ––maxduration=MM would result in AMP randomly selecting works which were longer than 10 minutes total duration but with no upper limit on the duration. ‘MM’ is not a number; therefore, maxduration ends up being set internally to 525960, which is effectively ‘not set’.

You’re also not allowed fractional or decimal minutes. Thus 10.2 would be rejected as invalid, because the ‘.’ is seen as a full stop, thus a piece of text, thus not numeric and thus we revert to the default ‘meaning unset’ value.

Be warned that using the duration filters can significantly increase the length of time AMP spends looking for music to play. If you get very specific and precise (say, min=2 and max=3), then AMP will potentially have to hunt for several minutes before randomly stumbling across something that meets the requirement. I would therefore recommend not trying to be quite so precise! Something like min=5 and max=30 will work reasonably quickly, most of the time.

Additionally, I’ll just mention that I’ve sprinkled a tiny bit of GUI magic in the script, in the sense that if you have installed xdotool, the terminal window in which you run AMP will re-size itself and when or if album art is displayed, it will move itself to be in the bottom/middle of your screen (where it first gets displayed was and remains a bit random!) If you haven’t got xdotool installed, these new bits of functionality simply don’t happen -and you’re not going to be prompted to install xdotool either. It’s another one of those ‘if you’ve got it, we’ll use it, but if you haven’t, we’ll just ignore that bit’ features, like displaying album art in the first place!

And the final bit of icing on the cake for this release is that the code has been tested on all 10 of the top ten distros listed at Distrowatch, provided they are independent. In other words, no I haven’t tested it on Pop_OS!, but because that’s an Ubuntu-based distro, and I have tested it on Ubuntu, I’m reasonably confident that it will work on Pop_OS! fine. The specific distros on which I tested were the latest desktop versions of:

  • Mint
  • EndeavourOS
  • MX
  • Solus
  • Ubuntu
  • Fedora
  • OpenSuse
  • Manjaro
  • Debian

The tests involved KDE Plasma, Gnome, Cinnamon, MATE , Budgie and LXQt desktop environments -which, I think, should mean I’ve pretty much tested any conceivable desktop environment it might ever run on! Incidentally, I also tested it on Ubuntu Server -and it ran fine (though for reasons I didn’t bother to investigate, I couldn’t actually hear anything from it! I assume it was the quirks of the virtual hardware I was running it on).

Short version: 1.11 is the most bug-fixed and tested release version of AMP ever. And that really does, as far as I can tell, end the current round of AMP development. It does all I could want it to do, and I can’t think of any new features I need to add to it.

Upgrading to the new version is as always:

  1. Download the new version from here.
  2. sudo chmod +x $HOME/amp.sh
  3. sudo mv $HOME/amp.sh /usr/bin

Leave a Reply

Your email address will not be published. Required fields are marked *