# Conditional formatting with featured artists to add to title and filename

**URL:** <https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423>\
**Category:** Support\
**Created:** [October 15, 2023, 9:09pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423 "2023-10-15T21:09:53Z")\
**Posts on this page:** 12\
**Page:** 2

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [October 17, 2023, 8:34am UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/21 "2023-10-17T08:34:59Z")

</div>

Thank you, I really appreciate your help. I realise it's frustrating when someone is as clueless as I am. I get frustrated because I wish I understood better.

---

<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:** [October 17, 2023, 8:51am UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/22 "2023-10-17T08:51:23Z")

</div>

How far have we got?

> [@sheepdisease](#):
>
> 1. The code should be used in Mp3tag to modify tags and filenames for music files.
> 2. The code should check for differences between the "Artist" and "Album Artist" fields in the music files.
> 3. If the "Artist" differs from the "Album Artist," the code should add "(feat. [all artists except album artist])" to the title field.
> 4. If there are multiple artists in the "Artist" field, the code should handle them properly.
> 5. The filename should include the track number at the beginning with 1-digit padding for track numbers 1-9.
> 6. The filename should not include a hyphen.
> 7. The code should use proper punctuation when there are featured artists (e.g., "feat. [artist1] & [artist2]" or "feat. [artist1], [artist2] & [artist3]").

1. The TITLE isn't the filename. So there will be at least 2 steps to get each in the way you want it. So far we have struggled with the ARTIST.
2. Still unsolved. The best way would still be a filter. But that is probably not sensible before there is only 1 artist left in the ARTIST field, so distributing data from ARTIST to FEAT\_ARTIST should happen prior to the comparison.
3. Still unsolved as it could also lead to strange effects when the spelling (Abba vs. ABBA) is different.
4. Solved, I would say.
5. Solved.
6. Solved.
7. Solved.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [October 17, 2023, 6:31pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/23 "2023-10-17T18:31:25Z")

</div>

1 seems to be working?

![image](https://community.mp3tag.de/uploads/default/original/2X/3/3b67bc7b27a946faef5c0768f763cd195cb3ed26.png)

2, isn't format value %FEAT\_ARTIST% adding the data to that field?

3 can be addressed how? A grammatron variant defining the case of specific artists or something else?

---

<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:** [October 17, 2023, 6:40pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/24 "2023-10-17T18:40:11Z")

</div>

2: I think that you do not have to refer to $meta\_sep() as there will be no multi-value fields for FEAT\_ARTIST. so a plain FEAT\_ARTIST is enough.

Format value sets a value to a field - it does not necessary add data. In this case it takes care of the punctuation.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [October 17, 2023, 6:43pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/25 "2023-10-17T18:43:21Z")

</div>

![image](https://community.mp3tag.de/uploads/default/original/2X/a/a72f3a853af8e4df3a3323373069d4a5c17c745d.png)

%FEAT\_ARTIST% appears populated after running action?

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [October 17, 2023, 6:44pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/26 "2023-10-17T18:44:41Z")

</div>

> [@ohrenkino](#):
>
> 2: I think that you do not have to refer to $meta\_sep() as there will be no multi-value fields for FEAT\_ARTIST. so a plain FEAT\_ARTIST is enough.

What is a multi-value field and how does meta correspond with that?

---

<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:** [October 17, 2023, 6:45pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/27 "2023-10-17T18:45:46Z")

</div>

> [@sheepdisease](#):
>
> What is a multi-value field and how does meta correspond with that?

See @LyricsLover 's post:

> [@Conditional formatting with featured artists to add to title and filename](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/8):
>
> There is "nothing" dividing the multiple ARTIST tag contents. That dividing character you see as \\ is only to represent a visible divider between the different ARTIST contents. Technically, there are 3 ARTIST tags in this example track: [image] If you would manually add \\Artist Four in the Tag Panel in the field Artist, it would end with a fourth ARTIST tag like this: [image]

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [October 17, 2023, 6:57pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/28 "2023-10-17T18:57:50Z")

</div>

So what does this mean? It would be better to store the data in %FEAT\_ARTIST% prior to conversion so a copy of the original data is retained? So rather than being populated with (feat. ARTIST) it lists all the artists from ARTIST? It could also add a separator between them in that field and then the data could be taken from there and converted afterwards so that it appears as (feat. 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:** [October 17, 2023, 7:10pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/29 "2023-10-17T19:10:20Z")

</div>

I would execute each of the action in a single step and then check what it has done to your data.  
Then you can decide what to do next.

If you need further information on particular scripting functions, I still recommend strongly the documentation

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

And then I would recommend that a single thread only should deal only with a single problem but not 7.

AFAI can tell, the initial problem of inserting commas, ampersands, brackets and "feat." has been solved.

---

<div class="post-metadata">

**Author:** ![sheepdisease](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sheepdisease](https://community.mp3tag.de/u/sheepdisease)\
**Post date:** [October 17, 2023, 8:44pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/30 "2023-10-17T20:44:42Z")

</div>

I have read through the documentation and it gives me an idea of the versatility of the application. It doesn't really make me any better at understanding or generating code on its own though.

As you say, the functionality requested has been unlocked. I don't think it was a case of asking multiple questions, more of trying to establish what could be done to safeguard/deal with potential complications.

That being said, from your own penultimate response it seems that there is scope to explore and refine this further. Perhaps someone else will find themselves in the same situation and be better equipped to deal with the logic and code involved to do that.

There are certainly possibilities.

---

<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:** [October 17, 2023, 9:05pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/31 "2023-10-17T21:05:18Z")

</div>

> [@sheepdisease](#):
>
> As you say, the functionality requested has been unlocked

That's good.

> [@sheepdisease](#):
>
> I don't think it was a case of asking multiple questions,

Well, there was a list of 7 tasks to be accomplshed ...

This forum is best if you describe single problems like

> [@sheepdisease](#):
>
> 1. The filename should include the track number at the beginning with 1-digit padding for track numbers 1-9.

So, if you still have problems with the other steps, then please open a new thread.

---

<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:** [November 16, 2023, 9:05pm UTC](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423/32 "2023-11-16T21:05:57Z")

</div>

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

[Previous page](https://community.mp3tag.de/t/conditional-formatting-with-featured-artists-to-add-to-title-and-filename/62423.md?page=1)
