Field Replication

OK, I read the stickies and searched and cannot find this. I was referred to mp3tag from the foobar forum, so today I downloaded mp3tag to give it a shot.

I would like to Conditionally Replicate like fields between files, for example, for all files with identical artist name, make all the genre's the same (with certain conditions)-- with the ability to conditionally copy data between files, I could use such a function to fill in all my genres or composers or date, etc. with one massive pass. I can write scripts in foobar but there is no way to conditionally copy data between files in foobar-- it takes 11 steps and has to be done one group (e.g., artist) at a time.

I've learned of the Actions in mp3tag but all of my searches have only yielded simplistic pieces of formulas, none of which reveal how to conditional copy internal data between files. Clearly that's the piece of the formula I'm lacking.

Thanks to anyone in advance for a any help you can provide, and have a great day!

You can easily write conditional actions. If you want to perform several of them in one pass, you would use an action group. ("Action group" is the mp3tag name for "macro." You can include as many actions as you want in an action group.)

For your example above, where you want all files with a particular artist name to be tagged with the same genre, you could include the action:

Action: Format value
Field: Genre
Format string: $if([artist],y,z)
where y=the artist you want to match, and z=the genre tag you want to write

You could put as many of these as you want in your action group.

can you give more details or a clear example for what you want to do?

passing data from one file to another is not possible with one actions. actions can deal only with the data of the file(s) which is/are to be changed.
however, there are several ways to get data out of one file and pass it to many others, e.g.:

  • export scripts and import text files,
  • formating a parent folder name and importing the data from the path,
  • using the filter of mp3tag and formating all filtered files with actions or the drop down selections in the tag panel
  • using conditional formating strings like progprog showed, e.g.: Formating all files genre with $if($eql(%artist%,Elvis),Rock n Roll,%genre%) would change only Elvis' songs to Rock n Roll and keep all other genres

Sorry for the delay, been in hospital, gallbladder-- ouch!..

Ok, say I have several albums containing various artists. Before I go looking up genre's I already have I would like to fill them in in mass using conditions: Most of my genre information I've entered are long strings, “Pop/Rock; Hard Rock, Singer Songwriter, Post-Grunge, Adult Alternative Metal” as an example. I would likely create a formula that looked for the longest string and does not contain the word “Holiday” and replicate that genre to all selected files if the artist matches. Also I would like to replicate other fields, like: the composer if the artist & title match find again the longest string in the set, and the date if the artist & tile match selecting the oldest valid date found in the set.

In your script, would it be creating txt files? I read somewhere about importing or exporting data using text files but dismissed it because I was under the impression (falsely?) that it could copy directly between files--

Is this description too short?

Your kind answers are appreciated, most forums I see initial replies are rude and off topic so again thanks!

And thanks in advance for future help, have a great day!

should be possible with temporary tag fields, export and reimport of textfiles, but rather complicated.
matching artists and titles must have exact the same spelling to get it working.

my idea:

  1. make a temporary tag field which contains the length of the value in other tag-fields:
  • the length of genre, 0 if it contains Holiday: $len($regexp(%genre%,.Holiday.,))
  • the length of composer: $len(%composer%)
  • not needed for the oldest date, because here you have already a number you can use for sorting
  1. display this tag field in Mp3tag and sort the files in two steps. first with the greatest number on top on the temporary field and then after your desired matching tag-field.

  2. export the files to a text file in such a way that you have one line for every file and a clear seprator like " || " between the tag field values. You will have to do three exports (for your three desired tag field replications). It should be possible, that:

  • the genre of the first file is repeated in every line until a file has a new artist name
  • the composer of the first file is repeated in every line until a file has a new artist and title name
  • the year of the first file is repeated in every line until a file has a new artist and title name
  1. now you have a text file with one line for every file with your desired tag field replicated. you can reimport this with the textfile-tag converter.

the complicated part at this process is to write the export scripts for step 3. if no one jumps in, i will see if i can do it if i find some time.

get well soon!

Hey, I hope you're feeling a lot better. That stuff doesn't sound fun... :flushed:

The extent of your conditional operations is probably a little beyond my pay grade, so hopefully you & pone can work out a solution. And yes! I absolutely agree about this forum- one of the most helpful I've encountered. (Those terse, rude, and often completely pointless responses are a pet peeve of mine! Why do they bother if they don't want to help?? :angry: )

pone, thank you so much for your help, and under the circumstances I would like to take you up on your offer-- if you could provide one functional example—genre? I can figure out how to create the other formulas. Modifying code has never been a problem for me but I can't see the first one yet so I'm stuck..
so again thank you so much for your help and I will patiently wait for what ever help you can produce..
and thanks for the get well soon message-- Being a vegetarian for a week is weird.

No money for surgery so I'm doin' the natural way, right now the pain is very mild compared to passin' stones but my Liver is very upset and swollen (sticks out, eeuu).

I agree 100%, the most common is-- why then they attack your reasons for why and never answer the question.

Thanks progprog

ok, I've got it. you can skip step 1 and 2 of my instruction above. because the sorting is defined by the export script, no matter how they are sorted in the mp3tag file list. i didn't know this. so i built the sorting expressions directly into the export script:

step 1:
export for genre: $filename(genre.txt,utf-8)$loop(%artist%)$loop($len($regexp(%genre%,.Holiday.,)))$puts(x,%genre%)$loopend()$loop($len($regexp(%genre%,.Holiday.,)))$get(x) || %artist% / Sort: $len($regexp(%genre%,.Holiday.,)) / %genre% || %_path%


export for composer: $filename(composer.txt,utf-8)$loop(%artist%)$loop(%title%)$loop($len(%composer%))$puts(x,%composer%)$loopend()$loop($len(%composer%))$get(x) || %artist% - %title% / Sort: $len(%composer%) / %composer% || %_path%


export for year: $filename(year.txt,utf-8)$loop(%artist%)$loop(%title%)$loop($sub(3000,%year%))$puts(x,%year%)$loopend()$loop($sub(3000,%year%))$get(x) || %artist% - %title% / Sort: %year% || %_path%


step 2:
Textfile-Tag Converter

formatstring for genre:
%genre% || %dummy% || %_path%

formatstring for composer:
%composer% || %dummy% || %_path%

formatstring for year:
%year% || %dummy% || %_path%

i hope it works. check the exportet text file before you go to step 3. the part in the middle, between the two || seperators, is only for controll. you see there the artist and title name if relvant, the number of the sorting field, and the original genre/composer/year, which is going to be overwritten by the genre/composer/year at the start of the line. the sorting is just the other way around as from my first idea. but that doesn't matter, it's now always the value of the last matching file that is written to the other files.

Got It!.. At least it seems for what I've tried.

Thank you thank you.

Q. To broaden matching Artists matches, is there a way to ignore/drop text in one or both of the following ways?

Disreguard all text after certain conjunctions, like "feat." | "; " | "with"
for example:
6 Feet == 6 Feet
6 Feet == 6 Feet feat. Storm
6 Feet == 6 Feet; Storm
6 Feet == 6 Feet with Storm

and simply drop text like "." and prefixes "A " and "The ":
Andrew WK == Andrew W.K.
Arc Angels == The Arc Angels

It took me a bit to figure a few things out as I'm new to Mp3tag

Is there a web site with examples or at least a complete list of commands so you don't have to do all the work for me?

Thank you again for your time and patience.
Hope all is well :slight_smile:

Well anyways, Thanks all for the help. The formulas resolved about 93% of the work which is something.

Have a good one.

P.S. I got rid of the gallstones painlessly without surgury-- good ol web and Apple Juice

I'm sorry, didn't saw your request.

$regexp(%artist%,( feat. |; | with).+,)
would do the thing in the for your first question.

$regexp(%artist%,(.|$The |$A ),)
for your second.

in combination:
$regexp(%artist%,(.|$The |$A |( feat. |; | with).+),)

I think it should work if you replace
$loop($regexp(%artist%,(.|$The |$A |( feat. |; | with).+),))

But there are some "traps" in the $regexp functions. For example, the bands "Nurse With Wounds" and "Nurse" will be treated as the same band.
And you can make a lot of refinements of the expressions. for example " (featuring|feat|ft).* " instead of " feat. " gets a lot of more spelling variations. And what about (presents|versus|vs|vs.). If you add an addition ",1" in the regexp function, you can ignore the case (The = the).

so maybe you want something like this:
|$A |( (featuring|feat|ft|with|presents|versus|vs).* |; ).+),,1))