Replace empty field


#1

I'm sure I'm missing something, but I want to replace empty ALBUM fields with a string and can't work out how to do it. Can I use "Replace with regular expression"? If so, what do I put in "Regular expression" to test for an empty field?

Any help appreciated.


#2

Ther alternative ways.
Either you filter your tracks with the filter expression
%album% IS ""
select all tracks, then enter the desired string in the album field in the tag panel and press save.

If you want to want to enter a certain string with an action then use the action

format field.
THere you can either enter a string or a variable so that the album is filled with some information that is already stored elsewhere


#3

Thanks. What I'm hoping is I can enter the equivalent of: %album% IS "" into the "Regular Expression" field of the "Replace With Regular Expression" function. Is there a way I can reformulate this for that function? I prefer this because I don't want to have to run manual filters repeatedly - "Replace With Regular Expression" gives me a function I can use over and over again - if I've understood things correctly.


#4

You want a mechanism to detect if a tag field is empty and if so, then do something related?
In Mp3tag the definition for "empty tag field" is the same as "tag field does not exist".
To check if a tag field exists respectively if a tag field has any content, you can use the Mp3tag functions $if or $if2.
$if(%ALBUM%,'yes, the tag field has any content','no, the tag field does not exist')
$if2(%ALBUM%,'no, the tag field does not exist')

DD.20100603.1955.CEST


Copy Feat. tags to Album Artist field
#5

Just what I needed - many thanks. I've used the Format Value action type and it worked perfectly.


#6

D, is this official? I.e. officially documented somewhere?

You know how I dislike relying on undefined behaviour. :slight_smile:


#7

Yes, in an example of the helpfile.

Anyway you overestimate "official".
Even if there is something documented somewhere now you cannot rely on it for the future because the developer could change it any time in a new version.


#8

Where, please?

I find none in C:/Program Files (x86)/Mp3tag/help/

I have faith the developer is not going to make an intentional breaking change to a function he declares in the documentation.

P.S. http://www.mp3tag.de/en/changelog.html
[2014-07-13] NEW: added scripting function $list(x,y,z) to official documented scripting functions.


#9

I do but I have the german help-file.
I now looked for the english online-version and indeed this example is missing.

Here's the german text (at the end of the scripting-section):

Beispiele
Befehl: $if2(%albumartist%,%artist%)

Erklärung: Es wird geprüft ob das Tagfeld %albumartist% vorhanden ist, wenn ja wird es ausgegeben, ansonsten %artist%.