Sometimes the scope of user variables in Exports is a little awkward to use, because it is not possible to use a variable that has been set previously within an outer loop. For some reason, the scope of the user variables extends outwards, not inwards.
This will not function (and it’d be nice if it did!):
Well, Moonbase, you are right to ask again for some better design and usability of user defined variables regarding their visibility in loops. I've mentioned it here and there in my postings over the years, too.
However your example is not quite good to demonstrate the point.
Your example is simplified like this:
'ECHO.'%_path%' >> '%genre%'.m3u'
Nevertelesse, this export script demonstrates how confusing it can be.
'ECHO.'%_path%' >> '$get(fn)
What also comes to mind is of course the apparent inefficiency in handling loop conditions. On a quite simple one, like
$loop($if(%origyear%,$div($left(%origyear%,4),10)0,$if(%year%,$div($left(%year%,4),10)0,'[unknown]')),1)which I use to provide playlists by decades, Mp3tag computes 2 hours 40 minutes for a smaller collection of only 22,845 MP3s (on a 1.8 GHz XP machine; no other applications running) while eating up between 98 and 99% CPU cycles… Which makes it not really the perfect choice for performing some everyday chores (though I’d like that, of course).