Export configuration for multiple artists

Hello,

In my export configuration, I have the following

$loop(%artist%,1) %artist%,$loopend()
$loop(%mixartist%,1) %mixartist%,$loopend()

But for some reason, it creates commas before and after the data like below

Artist: ,artist1, artist2,
Remixer: ,artist3, artist4,

How can I make it simple like below:

Artist: artist1, artist2
Remixer: artist3, artist4

there must be something else in this export script because when I use that snippet, I get a long list of artists, all separated by a comma - no leading commas. Or there are files where the artist is missing. Same applies the field mixartist: the empty one will be the first in the list.

Here is my export file

$filename(txt,utf-8)
%album%
 $loop(%artist%,1) %artist% $loopend()
REMIXERS:</span> $loop(%mixartist%,1) %mixartist% $loopend()
%publisher% - %genre%

But on Various Artist albums, all artist generated without separated by commas

Arude Binaryh Blancah Clawz SG Jobe Kris Davis Mashk Nick Devon Soul Button Soul Button, Nick Devon

I want to see it like:

Arude, Binaryh, Blancah, Clawz SG, Jobe, Kris Davis, Mashk, Nick Devon, Soul Button

Is that possible?

Thank you,
Gregory

Yes, because in

there is no comma.
it should be
$loop(%artist%,1) %artist%, $loopend()

I am not sure what the

is doing in that code as it concludes a
<span>
which I do not see.

Please ignore the /span

I just follow your suggestion please see below:

 $loop(%artist%,1) %artist%, $loopend()
 $loop(%mixartist%,1) %mixartist%, $loopend()

Results:

ARTIST: Arude, Binaryh, Blancah, Clawz SG, Jobe, Kris Davis, Mashk, Nick Devon, Soul Button, Soul Button, Nick Devon,
REMIXERS: , A, B, C,

The issue:

On the last artist "Nick Devon" as it's last there not the comma should appear.
REMIXERS: starts with a comma and ends with a comma.

I wish to see the correct export configuration as below:

ARTIST: Arude, Binaryh, Blancah, Clawz SG, Jobe, Kris Davis, Mashk, Nick Devon, Soul Button, Soul Button, Nick Devon
REMIXERS: A, B, C

Many thanks for your time.
Gregory

I know.
I do not think that it is possible with such a loop.
The comma in front of the mixartist suggests for me that you have a file without a mixartist. This file then sorts to be at the beginning of the list

I see, I thought it was easy with the loop settings. I hope in near future to be a solution on that.
Thank you very much for your time and help.

Regards,
Gregory

Inspired by Detlev's work, it's possible to collect all artists in a variable:

$filename(txt,UTF-8)
$loop(%ALBUM%)$puts(ListOfArtists,)$loop(%ARTIST%)$loop(%ALBUM%)$puts(ListOfArtists,$get(ListOfArtists)%ARTIST%', ')$loopend()$loopend()
$loop(%ALBUM%)$puts(ListOfArtists,$trim($regexp($get(ListOfArtists),'(?:(?<=,)|(?<=\A)|(?<=^))\s?([^,]*),(?=.*?(?<=,)\s?\1(?=,|\Z|$))(?#remove dups from comma- or comma+space- delimited list)',),', '))$loopend()
$loop(%ALBUM%,1)%ALBUM%
  $get(ListOfArtists)
$loopend()$loopend()

The same needs to be done for the %MIXARTIST% then. It's kinda magic — but fun :nerd_face:

2 Likes

... and all this just to avoid the trailing comma ... oh, well.
On the other hand: it proves that there is almost always a solution.
Enjoy.

Hello guys, @Florian

This configuration does the magic trick. Work perfectly on both %ARTIST% / %MIXARTIST%

Many thanks for that.

Regards,
Gregory

1 Like