# Export configuration for multiple artists

**URL:** https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992
**Category:** Export
**Created:** [March 8, 2018, 11:23am UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992 "2018-03-08T11:23:03Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![veggera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/db5fbb/32.png) [@veggera](https://community.mp3tag.de/u/veggera)
#### Post date: [March 8, 2018, 11:23am UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/1 "2018-03-08T11:23:03Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [March 8, 2018, 1:55pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/2 "2018-03-08T13:55:44Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![veggera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/db5fbb/32.png) [@veggera](https://community.mp3tag.de/u/veggera)
#### Post date: [March 8, 2018, 2:16pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/3 "2018-03-08T14:16:24Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [March 8, 2018, 2:59pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/4 "2018-03-08T14:59:47Z")

</div>

> [@veggera](#):
>
> But on Various Artist albums, all artist generated without separated by commas

Yes, because in

> [@veggera](#):
>
> $loop(%artist%,1) %artist% $loopend()

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

I am not sure what the

> [@veggera](#):
>
> \</span\>

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

---

<div class="post-metadata">

### Author: ![veggera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/db5fbb/32.png) [@veggera](https://community.mp3tag.de/u/veggera)
#### Post date: [March 8, 2018, 3:38pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/5 "2018-03-08T15:38:01Z")

</div>

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

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [March 8, 2018, 3:46pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/6 "2018-03-08T15:46:56Z")

</div>

> [@veggera](#):
>
> it's last there not the comma should appear.

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

---

<div class="post-metadata">

### Author: ![veggera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/db5fbb/32.png) [@veggera](https://community.mp3tag.de/u/veggera)
#### Post date: [March 8, 2018, 4:04pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/7 "2018-03-08T16:04:10Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Florian](https://community.mp3tag.de/user_avatar/community.mp3tag.de/florian/32/5759_2.png) [@Florian](https://community.mp3tag.de/u/Florian)
#### Post date: [March 8, 2018, 4:37pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/8 "2018-03-08T16:37:42Z")

</div>

> [@veggera](#):
>
> On the last artist "Nick Devon" as it's last there not the comma should appear.

Inspired by [Detlev's work](https://community.mp3tag.de/t/listing-all-artists-from-album-into-one-tag-field/14438/10), it's possible to collect all artists in a variable:

```auto
$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 🤓

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [March 8, 2018, 6:58pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/9 "2018-03-08T18:58:28Z")

</div>

> [@Florian](#):
>
> It's kinda magic — but fun 🤓

... 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.

---

<div class="post-metadata">

### Author: ![veggera](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/v/db5fbb/32.png) [@veggera](https://community.mp3tag.de/u/veggera)
#### Post date: [March 23, 2018, 6:20pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/10 "2018-03-23T18:20:20Z")

</div>

Hello guys, @Florian

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

Many thanks for that.

Regards,  
Gregory

---

<div class="post-metadata">

### Author: ![bollemanneke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/74df32/32.png) [@bollemanneke](https://community.mp3tag.de/u/bollemanneke)
#### Post date: [September 30, 2024, 4:26pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/11 "2024-09-30T16:26:02Z")

</div>

Would anyone be able to help me? I'm tyring to get this export result:  
work (artist, artist) etc. So far, I have this:

```auto
$filename(txt,utf-8)
$loop(%work%)%work% ($loop(%artist%,1)%artist%$if($next(%artist%),', ',))$loopend()
$loopend()

```

However, this results in this: Artist, ARtist, ).

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 30, 2024, 5:30pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/12 "2024-09-30T17:30:38Z")

</div>

Where did you get this syntax?

> [@bollemanneke](#):
>
> `$if($next(%artist%),', ',)`

Esp. $next() seems to be a function that I cannot find in the documentation:

> **[Scripting Functions – Mp3tag Documentation](https://docs.mp3tag.de/scripting/)**
>
> Documentation on Mp3tag's scripting functions. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

### Author: ![bollemanneke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/74df32/32.png) [@bollemanneke](https://community.mp3tag.de/u/bollemanneke)
#### Post date: [September 30, 2024, 5:51pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/13 "2024-09-30T17:51:54Z")

</div>

Chat GPT gave that to me.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 30, 2024, 6:52pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/14 "2024-09-30T18:52:16Z")

</div>

I would ask Chat GPT what has to be modified as that code does not work.

```auto
$filename(txt,utf-8)
$loop(%work%)%work% ($loop(%artist%)%artist%, $loopend())
$loopend()

```

What about this code?

---

<div class="post-metadata">

### Author: ![bollemanneke](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/b/74df32/32.png) [@bollemanneke](https://community.mp3tag.de/u/bollemanneke)
#### Post date: [September 30, 2024, 7:06pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/15 "2024-09-30T19:06:53Z")

</div>

Well, this one repeats recurring artists and still ends with , ). ChatGPT is stuck, I asked it about ten times.

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [September 30, 2024, 7:10pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/16 "2024-09-30T19:10:32Z")

</div>

Or what about the code from this post?

> [@Export configuration for multiple artists](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/8):
>
> Inspired by [Detlev's work](https://community.mp3tag.de/t/listing-all-artists-from-album-into-one-tag-field/14438/10), 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) $lo…

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [October 30, 2024, 7:10pm UTC](https://community.mp3tag.de/t/export-configuration-for-multiple-artists/40992/17 "2024-10-30T19:10:36Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
