Exporting List of Unique Genres w/o Final Comma

My current script is:

$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$regexp($loop(%genre%,1)%genre%, $loopend(),', $',)

For a selection of 20 songs I’m working with, the result is:

Euro House, Hands Up, Hard House, Hard Trance, Progressive House, Progressive Trance, Trance,

The issue is the final “, ” that it won’t remove for some reason. What am I doing wrong here?

Thanks.

You could try it with:

$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$regexp($loop(%genre%,1)%genre% 
$loopend(),', $',)

I have not tried to further adjust the logic in your code.

Try

$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$loop(%genre%,1)$puts(g,$get(g)%genre%', ')$loopend()$regexp($get(g),', $',)

That worked. Remarkable!

I tweaked it slightly to utilize multiple genre tags per track:

$filename(F:\Parallel Music Miscellanea\Templates\test.txt,utf-8)$loop(%genre%,1)$puts(g,$get(g)$meta(genre)', ')$loopend()$regexp($get(g),', $',)