Two columns to check for errors

I’m pretty strict and tedious about my tags, which perhaps a lot of you are. I have some questions how to have columns which will show tags that does not follow my schemes and so on.

Basically I want to have two failcheck columns, one that shows all my needed tags that not present [Missing tags] and one that shows tags that does not follow my naming schemes [Wrong tags]


  1. [Missing tags] column should display:

IF
%album% OR
%albumartist% OR
%artist% OR
%discnumber% OR
%genre% OR
%publisher% OR
%title% OR
%track% OR
%year% OR
%_covers%
IS EMPTY
RETURN ”Missing tags”

Otherwise RETURN nothing (blank).


  1. [Wrong tags] column should display

IF
%artistsort% OR %barcode% OR %bpm% OR %encoder% OR %length%
IS PRESENT
RETURN ”Too many tags”

IF
%_id3v2_character_encoding%
IS NOT UTF-16
RETURN ”Charset”

IF
%discnumber%
DOES NOT CONTAIN /
RETURN ”Disc #”

IF
%year%
IS MORE THAN 4 CHARACTERS
RETURN ”Year”

IF
%_covers% IS MORE THAN 1
RETURN ”Cover”

Otherwise RETURN nothing (blank).


Have a good day folks! Cheers :smiley:

see the help on scripting where you will find a number of functions for conditions and comparison.
You can enter these scripting commands in "Value" of the column definition.
Also see the help on Filters as this may serve a similar purpose.
In general:
If you use such rather complicated expressions in columns, then these expressions will have to be evaluated each time you load the files. Also they have to be evaluated at runtime as the result is not saved in any tag field.
This may prolong the loading time and reaction times.
As the cleanup would happen only once in a life time of a file (I hope), it may be easier to use filters.
If you have certain fields that you never want to see or, the other way round, you have a list of fields that you always and only want to keep, then run an action that removes certain fields or all fields except. This would spare you the column for

An action of the type "Format value" would work for YEAR where you simply cut the data to just 4 digits - if you want to do that anyway, you would not need the extra error condition.
The character encoding would be adapted as soon as you save tags with the corresponding settings in MP3tag - so you would not need that alarm.

As @ohrenkino says, error checking is a bit too much to setup in the columns. Here's what I do instead:

I use an action group to create the custom field ! ERROR when an error is detected. The exclamation mark places the field(s) at the top of Extended Tags (Alt+T) to be easily seen.

You could have this action group:


Remove fields: ! ERROR

Format value
Field: ! ERROR
String: $meta_sep(! error,\\)\\$if(%album%,,ALBUM is missing)

Format value
Field: ! ERROR
String: $meta_sep(! error,\\)\\$if(%artistsort%,ARTISTSORT is wrongly present,)


This covers your first required field and your first wrong field. You can add as many error checks as you need.

Each string starts with $meta_sep(! error,\\) and then you add \\ and lastly the error checking script.

When you run the action group it starts by removing all ! ERROR fields (to start blank). Then, if an error is detected, a new field will be added.

Additionally, my leftmost column is an indicator:

Name: !
Value: $if(%! error%,!,)

So if I see an exclamation mark in that column, I hit Alt+T to check out the error(s). Then I fix them, then I run the action group again until no error persists.

In your case, if you want to remove certain fields automatically (instead of getting an error message), you can insert more "Remove fields" in the action group, or even "Remove fields except" (but be careful).

1 Like

Thanks for the feedback guys! I can see how your solutions could be used and I appreciate your input.

However, I will still use these two columns for mp3tag, before adding music to my library. And as @ohrenkino mentions, when doing the actual clean up I will disable these columns.

To give other people solutions I will post my values for the columns below:


  1. [Missing tags] column should display:

IF
%album% OR
%albumartist% OR
%artist% OR
%discnumber% OR
%genre% OR
%publisher% OR
%title% OR
%track% OR
%year% OR
%_covers%
IS EMPTY
RETURN ”Missing tags”

Otherwise RETURN nothing (blank).

Value for column:

$if($and(%album%,%albumartist%,%artist%,%discnumber%,%genre%,%publisher%,%title%,%track%,%year%,%_covers%),,Missing tags)

This will look and see if ALL tags are present. IF TRUE returns blank, IF FALSE returns "Missing tags"


  1. [Wrong tags] column should display

IF
%artistsort% OR %barcode% OR %bpm% OR %encoder% OR %length%
IS PRESENT
RETURN ”(Too many tags)”

IF
%_id3v2_character_encoding%
IS NOT UTF-16
RETURN ”Wrong Charset”

IF
%discnumber%
DOES NOT CONTAIN /
RETURN ”Wrong Disc# format”

IF
%year%
IS MORE THAN 4 CHARACTERS
RETURN ”Wrong Year format”

IF
%_covers% IS MORE THAN 1
RETURN ”Too many Covers”

Otherwise RETURN nothing (blank).

Value for column:

$cutRight($if($or(%artistsort%,%barcode%,%bpm%,%encoder%,%length%),(Too many tags) | ,)$if($eql(%_id3v2_character_encoding%,UTF-16),,Wrong Charset | )$if($grtr($strchr(%discnumber%,/),0),,Wrong Disc# format | )$if($eql($len(%year%),4),,Wrong Year format | )$if($grtr(%_covers%,1),Too many Covers | ,),3)

This will display what errors is found, separated by a vertical line (|), and also trim the last vertical line.


2 Likes

I actually ended up using all functions in one single column instead, and will also share my value for other people to use if they want to.

Value for the column I ended up using:

$cutRight($if(%album%,,Album | )$if(%albumartist%,,Album Artist | )$if(%artist%,,Artist | )$if(%discnumber%,,Disc# | )$if(%genre%,,Genre | )$if(%publisher%,,Label | )$if(%title%,,Title | )$if(%track%,,Track# | )$if(%year%,,Year | )$if(%_covers%,,Cover | )$if($and($eql(%_id3v2_character_encoding%,UTF-16),$grtr($strchr(%discnumber%,/),0),$eql($strchr(%track%,/),0),$grtr($left(%track%,1),0),$eql($len(%year%),4),$eql(%_covers%,1),$eql(%_cover_type%,Front Cover)),,(Wrong tag format) | ),3)

Explanation for all values used:

$cutRight(values_in_here,3)

I need to cut the last three characters since I separate error results using a vertical bar and spaces. It just looks better this way.

$if(%album%,,Album | )
$if(%albumartist%,,Album Artist | )
$if(%artist%,,Artist | )
$if(%discnumber%,,Disc# | )
$if(%genre%,,Genre | )
$if(%publisher%,,Label | )
$if(%title%,,Title | )
$if(%track%,,Track# | )
$if(%year%,,Year | )
$if(%_covers%,,Cover | )

Checks for the tags music files must have, and if not it will tell me which one is missing.

$if($and(
$eql(%_id3v2_character_encoding%,UTF-16),
$grtr($strchr(%discnumber%,/),0),
$eql($strchr(%track%,/),0),
$grtr($left(%track%,1),0),
$eql($len(%year%),4),
$eql(%_covers%,1),
$eql(%_cover_type%,Front Cover)
),,(Wrong tag format) | )

Checks to see if:

Character encoding is UTF-16
Disc number contains /
Track number does not contain /
Track number does not being with a 0
Year is only 4 characters
Covers is only 1
Cover type is Front Cover

if not, returns "(Wrong tag format)"

1 Like

How about this code?

$if(%ARTIST%,$if(%ALBUM%,$if(%ALBUMARTIST%,'+ OK +','- Album Artist'),'- Album'),'- Artist')

Could anyone hep me out please?


[This forum has an issue with displaying space in quotes- watch out when writing ]


It works as long as I do not have anything in the tag of ALBUMARTIST. Unfortunately: it is convenient for me to add a single space at end of each tag field- because when I copy them I usually do it for the purpose of using their content in the Filter Box - and most of the time followed in the Filter Box by a single space. So a single space at the end of any tag field saves me time in overall - but then it breaks this used seldomly code, because it reports visually empty ALBUMARTIST tag fields as being "+ OK +" because of them containing " " [a single space]. How to tell this code to disregard such cases thus still return the "- Album Artist" info in the column?

I could also settle for using something like ". " [a dot followed by a single space] instead of just " " [a single space] - that way I would see a dot where I do not want to or cannot fill in data for ALBUMARTIST . But then again: the code should treat such fields containing only ". " as an empty [i.e. erroneous] fields

And I think I forgot to explain the thought and inner workings behind the current code


It first looks at ARTIST to see if it is filled- as it is [for me] the most important piece of information after the TITLE. And if the ARTIST field is empty then he column it displays - Artist [meaning the of all things the most important info about artist is missing]

Then it looks at ALBUM to see if it is filled. If ARTIST is filled but ALBUM is not, the column displays - Album [meaning the album is missing but artist is filled]

And at last it looks at ALBUMARTIST to see if it is filled with data. If not, the column displays - Album Artist [meaning the info about the artist of the album is missing missing while those about artist and album are present]


And so if I have in ALBUMARTIST a pause [which is for me equal to nothing], then the column shows it as being filled with data [+ OK +] - which is technically true but not true for me. And so, wanting to retain such pauses, I need the code to ignore them and to start reporting them as - Album Artist

@Zerow sure I can help you with the code, however it is kinda hard to understand your dilemma. Perhaps one of these Values works. Both checks the following tags and also counts a single blank space as a missing tag:

%artist%
%title%
%album%
%albumartist%

Value 1 (displays what tags is missing and returns nothing if everything is ok)

$if(%artist%,,- Artist )$if($not($eql(%artist%,' ')),,- Artist )$if(%title%,,- Title )$if($not($eql(%title%,' ')),,- Title )$if(%album%,,- Album )$if($not($eql(%album%,' ')),,- Album )$if(%albumartist%,,- Album Artist )$if($not($eql(%albumartist%,' ')),,- Album Artist )

Value 2 (displays what tags is missing and returns + OK + if everything is ok)

$if($and(%artist%,$not($eql(%artist%,' ')),%title%,$not($eql(%title%,' ')),%album%,$not($eql(%album%,' ')),%albumartist%,$not($eql(%albumartist%,' '))),+ OK +,$if(%artist%,,- Artist )$if($not($eql(%artist%,' ')),,- Artist )$if(%title%,,- Title )$if($not($eql(%title%,' ')),,- Title )$if(%album%,,- Album )$if($not($eql(%album%,' ')),,- Album )$if(%albumartist%,,- Album Artist )$if($not($eql(%albumartist%,' ')),,- Album Artist ))

I'd prefer Value 1 since a blank result is just as good as OK, and less code is needed. But it's a personal preference.

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