Moving [Feat. Artist] from Title to Artist

I've seen this topic come up several times and I've tried a bunch of combinations but nothing seems to be changing. I think it may be to do with the [] brackets but I don't know enough to change the code.

Current example:

Title: Payphone [Feat. Wiz Khalifa]
Artist: Maroon 5

Ideal end product:

Title: Payphone
Artist: Maroon 5 [Feat. Wiz Khalifa]

How would I go about doing this?

Also, a couple other questions; how would I create the opposite if necessary, e.g. moving [Feat. Artist] from Artist to Title?
How would I copy it so it ends with Title [Feat. Artist] and Artist [Feat. Artist]?

Thanks

Please have a look at this thread:

I have, and I've tried several of the solutions, none of which seem to be working. And I realise it may well be in there but there's over 100 posts to look through and that seems like an incredible amount of trial-and-error if someone has the answer for this specific query.

Perhaps this one is shorter:

I see that all those posts on the same topic can be a little overwhelming at first. Basically, it's so many posts because the actual format of the featuring artist in the tags differ from question to question — which eventually leads to a lot of back and forth and answers to the specific formatting of the featuring artist.

I try to answer your question with the intention to explain the solution, so that — ideally — you can answer the second part of the question by yourself. Please don't imply by that, that you're not welcome to ask again if something is unclear or you're stuck :slight_smile: It then simply means that I've explained it in a way that was not understandable to you.

To draw out the abstract approach on moving parts of one tag field to another in Mp3tag:

  1. Optional: use a regular expression to transform the source data in a format where the individual parts are denoted by unique separators.
  2. Use an action "Guess values" to create a source format that makes the parts you want to move explicit.
  3. Use the guessing pattern of the "Guess values" action to describe which tag fields should be filled with which parts of the source format.

The first step when moving parts from one tag field to another is to identify the parts that need to be moved. In your example it's the name of the featuring artist. We need to somehow denote this part by describing it's context. That is, explaining to Mp3tag, how it would find this part you've already spotted by the magnificent powers of pattern matching of the human brain. Since the AI of Mp3tag is very limited, this is done by means of regular expressions in this case.

If you're unfamiliar with it, there is https://regex101.com/, where you read about can try regular expressions and get an explanation for what matches and what not.

In your example, denoting the part by describing it's context is done by telling Mp3tag, that there is some text, then a blank then an opening square-bracket followed by the text "Feat. " and then it's the name of the featuring artist following by a closing square-bracket.

Written as regular expression (which is the language Mp3tag understands), the whole thing looks like
(.*) \[Feat\. (.*)\]

(We need to use \ to escape certain characters, because they have a special meaning in the language of regular expressions.)

What's nice about the regular expression above is, that we can reuse the parts that were matched in the groups that where denoted by (.*). The format for referencing match groups is $1 for the first group, $2 for the second group and so on.

The second step is to describe the source format for the "Guess values" action. The basic idea is to create a source format that enables us to import parts to the desired fields. Based on your example, one such format would be

TITLE +++ ARTIST [Feat. FEATURING ARTIST]

This explicitly denotes the title part and the artist part (incl. feat. artist) by +++.

Based on what we've described above regarding regular expressions, match groups and so on, a valid source format would be

$regexp(%title%,'(.*) \[Feat\. (.*)\]',$1 +++ %artist% '['Feat. $2']')

This uses Mp3tag's scripting function for regular expressions, where you can give a the string to apply the regular expression on (it's the contents of the title field), a regular expression and a replacement (which optionally reuses what we've matched by using $1, $2, ...).

The guessing pattern then simply describes the parts to be imported to which field:

%title% +++ %artist%

Hope this is helpful. If something is unclear, I'm happy to improve it.

2 Likes

Amazing, thank you very much, you've been really helpful.

1 Like

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