Select 3 Hrs. of Random Tracks per Album

The following export configuration selects up to 3 hours of random tracks from each album, with a minimum of 2 track per album. Each album is in a separate folder. It requires you 1st place and sort by a column with value=$rand() in Mp3tag (mine is field %random%).

$filename($getEnv('USERPROFILE')'\desktop\TrackSelect.M3U8',UTF-8)

Sort by Column=Random in MP3Tag before running this Script ####$loop(%album%)$loop(%random%)$puts(TrackCount,$add(1,$get(TrackCount)))$if($or($leql($get(PlayLngth),9001),$leql($get(TrackCount),2)),

%track%|1. Favorites|%album%|%_length_seconds%|rename "%path%" "zz%_filename%.mp3",)$puts(PlayLngth,$add(%_length_seconds%,$get(PlayLngth)))$loopend()$puts(PlayLngth,0)$puts(TrackCount,0)$loopend()

Note: I print out %track%|1. Favorites|%album%|%_length_seconds%|rename "%path%" "zz%_filename%.mp3" This is for further post-Export processing (I limit track selection to a maximum cumulative length by Ranking=Favorites, etc.). I copy & paste the rename command into Windows/DOS to allow searching in Windows/XP for my selected tracks across the many album folders.

You can print out whatever fields best suit your needs.

Enjoy

It is always amazing how ideas can be realized in Mp3tag. :wink:

Do you be aware of, that you can randomize the order of the files in the list view Mp3tag, when you click on the column header in the very first column (this one with the icons)?
There is no need to set up a column having a special random value.

And what I do not understand is the export code ... $loop(%random%) ...
does it sort the random value ... for which purpose?

DD.20150502.0817.CEST

Didn't know about the in-built randomizing sorting. Cool. Thanks.

I modified this Export Config using a pre-existing Config and needed something for the inner loop that wouldn't disturb the order of my manual sort... hence I selected my custom %random% column. May not be necessary and perhaps can be done with just the %album% loop?

Export configs are a quite powerful tool once you get use to their quirks (if statements within puts are weird, but puts within if statements are okay). Perhaps someone could set up a thread with examples, much like the regexp thread?

Also, I have 5 versions of this Export config, with the only difference being my rating of the album which I need in the output file (e.g. 1. Favorites). This rating is stored outside of the .mp3 tags (as a comment in a shortcut pointing to the album folder). Is there a way to ask for and store some simple user input in an Export Config?

Great product.