[X] FORMAT statements step on each other, corrupting results

I have a FORMAT statement that cuts lengthy titles to a maximum length at the closest word break, but only if the title is too long (i.e., I don't want to slowly eat away at the title each time I run the action). Action #1 below works just fine for this, but not if it comes after Action #0.

Here's the Action Group = test.mta

[#0]
T=5
F=TITLE
1=$if($eql(%album%,'Any Other Album'),$regexp(%title%,'\\d+',),%title%)

[#1]
T=5
F=TITLE
1=$if($eql(%album%,'The John Batchelor Show'),$if($grtr($len(%title%),20),$regexp($left(%title%,20),'\\s[^\\s]*$',),%title%),%title%)

#1 stops working in the above .mta, but if you change \\d+ to \\d in #0 then #1 works just fine. Alternately you can flip the order of #1 and #0 and #1 will work.
The syntax of #0 and #1 are both correct, and work fine when used alone. Together #0 breaks #1.

This was tested with a fresh install of the latest version of Mp3tag.

test.mp3 (8.79 KB)

test.mta (251 Bytes)

I am rather puzzled about the \\d as this masks the \ so that you do not really look for a number.
What is that supposed

It is the escaped code from inner mta file.
We rarely communicate on this way.

DD.20150803.2003.CEST

The regular expression works this way ...

$regexp(%TITLE%,'\d+',) "This is 1 test of 99 tests in 123 files." -> "This is test of tests in files."

This works fine ...

$if($grtr($len(%TITLE%),20),$regexp($left(%TITLE%,20),'\s[^\s]*$',),%TITLE%) $ifgreater($len(%TITLE%),20,$regexp($left(%TITLE%,20),'\s[^\s]*$',),%TITLE%) "This is 1 test of 123 tests in 99 files" -> "This is 1 test of"

Which meaning does the if-clauses have?

$if($eql(%ALBUM%,'Any Other Album'), ... $if($eql(%ALBUM%,'The John Batchelor Show'), ...

What does this mean in practice?
"#1 stops working in the above .mta"

This works fine ...

Begin Action Group 20150803.Test.rko Action #1 Actiontype 5: Format value Field ______: TITLE Formatstring: $if($eql(%ALBUM%,'Any Other Album'),$regexp(%TITLE%,'\d+',),%TITLE%) Action #2 Actiontype 5: Format value Field ______: TITLE Formatstring: $if($eql(%ALBUM%,'The John Batchelor Show'),$ifgreater($len(%TITLE%),20,$regexp($left(%TITLE%,20),'\s[^\s]*$',),%TITLE%),%TITLE%) End Action Group 20150803.Test.rko (2 Actions) File 1: ALBUM='Any Other Album' TITLE= ... "This is 1 test of 99 tests in 123 files." -> "This is test of tests in files." File 2: ALBUM='The John Batchelor Show' TITLE= ... "This is 1 test of 99 tests in 123 files." -> "This is 1 test of" File 3: ALBUM='Album' TITLE= ... "This is 1 test of 99 tests in 123 files." -> "This is 1 test of 99 tests in 123 files."

The results are always the same regardless of any order of the three files.

There is no justification for a bug report.

The MTA file ...

[#0]

T=5
F=TITLE
1=$if($eql(%ALBUM%,'Any Other Album'),$regexp(%TITLE%,'\\d+',),%TITLE%)

[#1]
T=5
F=TITLE
1=$if($eql(%ALBUM%,'The John Batchelor Show'),$ifgreater($len(%TITLE%),20,$regexp($left(%TITLE%,20),'\\s[^\\s]*$',),%TITLE%),%TITLE%)

20150803.Test.rko.mta (255 Bytes)

DD.20150803.2126.CEST

20150803.Test.rko.mta (255 Bytes)

Hence the bug report.

Sorry for last post. I missed the subtle difference you made in the formulas.

I used: $if($grtr($len(%title%),20)
You used: $ifgreater($len(%TITLE%),20

Yours worked, mine didn't.

I'm okay with that. I'll just have to remember not to use $grtr in FORMAT statements from now on.

rko

Just to make sure ...

Action "Format value" Tag-Field ..: TEST Formatstring: $if($grtr($len('1234'),3),'is greater','is not greater') ==> 'is greater' ... or ... Formatstring: $if($grtr($len('1234'),4),'is greater','is not greater') ==> 'is not greater' ... or ... Formatstring: $ifgreater($len('1234'),3,'is greater','is not greater') ==> 'is greater' ... or ... Formatstring: $ifgreater($len('1234'),4,'is greater','is not greater') ==> 'is not greater'

DD.20150803.2253.CEST

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