Creating separate links for multiple artists in export template using Mp3tag version 3.12

Hello,

I'm using Mp3tag version 3.12 and need assistance with my export template. My goal is to create separate links for each artist when there are multiple artists in the "artist" field, separated by a comma. The same should apply to the "mixartist" field if it's available.

I tried using the $meta_sep() function in my export template to handle this situation, but it seems that this function isn't supported in version 3.12.

Here's the export template I'm using:

htmlCopy code

$filename(export-rapperse.txt,utf-16)<figure class="wp-block-table is-style-stripes"><table><tbody>$loop(%_filename_ext%)<tr><td>'['sc_embed_player fileurl="https://rapperse.com/wp-content/uploads/$replace(%albumartist%-%album%-%_filename_ext%,'(',,')',,&,, /,,'[',,']',, - ,-, ,-,'',,#,,:,,!,,*,,',',,$,,%,,",,'’',,?,,;,,/,,%,,+,,=,,--,-,)"']'</td><td>$replace(%track%,&,&amp;)</td><td width="50%%">$meta_sep(artist,', ',<a href="https://rapperse.com/rapper/$lower($replace(%artist%,&,&amp;, ,-,',',))/">$replace(%artist%,&,&amp;)</a>)</td><td width="50%%">$replace(%title%,&,&amp;)</td><td>$replace(%_length%,&,&amp;)</td></tr>$loopend()</tbody></table></figure>

Could you please guide me on how to handle this situation using Mp3tag version 3.12, or suggest an alternative method for creating separate links for each artist when there are multiple artists in a metadata field?

Thank you.

Could you check the extended tags dialogue whether you have several fields of the type ARTIST in those files of a single field with names separated by commas?

Dear ohrenkino,

In our case, we have a single field with artist names separated by commas rather than having several fields of the type ARTIST for those files.

Best regards,
Svetoslav

In that case the function $meta_sep() will not help you. The separator works only if you merge multi-value fields at the time of access.
So, you assumption that

is not correct.
You would have to either add a conditional expression for each possilbe $meta() entries (which again requires several separate ARTIST fields) or you have to create an expression that goes through that comma separated list several times.

A hint: you can test scritping functions with the preview in Convert>Tag-Tag.

ohrenkino

Thanks for the advice.

We were able to get the code to work after splitting the artists from the mixartist field into separate fields - mixartist1, mixartist2, etc.

The challenge now is to make a batch process to separate each artist into a separate field. The good news is that our collection is well structured, with the unique separator of all artists being a simple comma. We already tried the tag-tag conversion, but the procedure is too complicated because there are songs with different number of artists and the script has to be changed manually accordingly.

On that note, I was wondering if it is possible to configure a sequence of actions that achieves the desired result of splitting all artists from the mixartist field into separate fields mixartist1, mixartist2, etc.

I hope the description of what we are trying is clear enough and that you could help us again with advice.

Thanks in advance.

Regards,
Svetoslav

If you create an action that replaces the comma (space) with 2 backslashes \\ then this will create several fields of the same type, e.g. ARTIST

You can then address these fields separately with $meta(artist,0), $meta(artist,1), $meta(artist,2) ...
To find the number of fields so that you can adapt the script, use a filter like
$meta(artist,4) PRESENT
If that leads to an empty file list, then you know that there are no more than 4 fields of the type ARTIST. You could then filter for lower numbers to see how many there are.

Instead of $meta_sep() use $meta() and to make it conditional, use the square brackets

1 Like

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