Conditionally deleting id3v2 tags with actions?


As described in another topic, i want to remove tag frames with a certain content. I am setting these unavailable tag frames to "n/a". Until now, i used an replace tag action like this:

Field: _TAG
Original: "n/a"
Replace With: ""

to empty (and thus remove) all fields marked as unavailabe. Looking back, I'm not sure if this ever worked. After applying my action, the tag frames are still in the file, just with empty content, ie. they are not removed. So, it seems that the code that removes empty fields is not triggered when emptying a field from an action.
I guess, it is tied to UI "Save Tag" functionality. Manually invoking the extended tag dialog and saving the tags gives me the desired result, the empty tag frames are actually removed from the file.

How can i conditionally delete all tag frames with a specific fixed string from within an action without further user interaction?



Remove the "Double Apostrophes" from the "Original" and "Replace" edit fields, and it should work as expected.

It has been already pointed out to you what to do right by user pone there ...
Verwendung von %Platzhalter% in Remove Fields action erlauben

The "Double Apostrophe" has only the meaning of a string delimiter in the Mp3tag Filter section.

But there might be a problem ... when using the simple action "Replace" to do such deleting.
How should the action "Replace" know whether 'n/a' is the one and only textual content of the tag-field?

The action "Replace", working on the pseudo tag-field _TAG, is able to replace all occurrences of 'n/a' in all tag-fields! This might lead into big disappointments.

Better you use an action "Replace using Regular Expression" to make sure to remove only tag-fields having the string 'n/a' as the only content.

Action: Replace using Regular Expression
Field: _TAG
Regular expression: ^n/a$
Replace matches with:
Case-sensitive comparison:



Hello Detlef,

I added the quotes only to point out that the action replaces n/a with nothing. The fields in the action dialog do not contain any apostrophes. Anyway, as I also wrote, the action does only replace the contents, but does not remove any empty fields. I do not know if this has been changed with one of the last mp3tag versions or if it has never worked.

So I'm still looking for a way to achieve what i asked for. Conditionally deleting all fields with a fixed string content with an action but w/o further user intervention.

Replace does not do the job.

Of course i read what pone wrote and this was exactly what i was doing. But, as mentioned above and in my initial post, it does not delete the fields, it just empties them.



I've tried the task using the action "Replace" with mp3 files having tag-fields containing only text 'n/a' ... and it works as expected. Mp3tag automatically removes all empty tag-fields from the tag, I have checked it using dialog "Extended Tags...".
If you got other result, then there might be going on something unusual at your side, please check it again.



I can confirm this.
You don't see the tags any more in Mp3tag, but you can see empty frames for example with a hex editor.

[X] Adding a field loses empty fields

Yes, this is what i did too. The frames are still in the file, they have just zero length values. Detlef, mp3tag does not show empty tags so it does not make sense to rely on mp3tag to confirm if the tags have been removed or not.

I noticed the problem only because my mp3 player showed me empty album tags where i didnt expect album tags at all.


Now I understand that you were looking behind the scenes at the binary level, and that you were talking all the time about technical ID3 data frames, not ID3 tag-fields.
And I have spoken about the behavior of Mp3tag from the perspective of the normal user.

You should complain to the manufacturer of your mp3 player that empty frames should not be respected and should not be displayed to the user.
You should complain to the manufacturer of Mp3tag that empty frames should be completely deleted.